Skip to main content

Automatic Tastypie URL builder by way of import discovery.

Project description


Django Tasypie Resource Url Builder
===================================


Just something I felt should be automated.


in your toplevel urls.py :

{{{
from django.conf.urls import patterns, include

from piehunter import PieHunter

api_urls = PieHunter(api_name='v1',
dotted_path='api.resources',
enabled_attribute='EnabledResources')

urlpatterns = patterns('',
surl(r'^api/', include(api_urls)),
surl(r'^beta/', include('hunger.urls')),
)
}}}

Now in your applications you would have a directory structure like so :

{{{
/
__init__.py
urls.py
models.py
admin.py
templates/
static/
...

}}}

Throw your Tastypie resources into the api module to end up with something like :

{{{
/
__init__.py
urls.py
models.py
admin.py
templates/
static/
api/
resources.py
...
...
}}}

At the end of your `api.resources` module, include a list/set of resources you want to use :

{{{
EnabledResources = (TrooperResource,
DeathstarResource,
EvilGrinResource,
)
}}}

That's it, piehunter will now hunt for and include any resource found to be in a api.resources.EnabledResources

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-piehunter-0.0.1.tar.gz (2.5 kB view details)

Uploaded Source

File details

Details for the file django-piehunter-0.0.1.tar.gz.

File metadata

File hashes

Hashes for django-piehunter-0.0.1.tar.gz
Algorithm Hash digest
SHA256 24048b263e1008bbf459ab5b07c2f14205ccd21b2581f5df7efc7bda9873f0fd
MD5 968b39a404e6ac5d847545766984c432
BLAKE2b-256 c1a81b97f2db667ee4d9a4cecff962cbf2bbe94d84d7b5beaa8665857ad6728b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page