1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | from django.conf import settings
from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
def if_installed(appname, *args, **kwargs):
ret = url(*args, **kwargs)
if appname not in settings.INSTALLED_APPS:
ret.resolve = lambda *args: None
return ret
urlpatterns = patterns('',
if_installed('myapp', r'^myapp/', include('myapp.urls')),
(r'^admin/', include(admin.site.urls)),
)
|
More like this
- Resolve URLs to view name by UloPe 4 years, 2 months ago
- Serve static media files from app/media subdirectory by adamlofts 4 years, 9 months ago
- Resolve URLs to view name and args/kwargs by fahhem 2 years, 6 months ago
- Url filter middleware by limodou 6 years, 2 months ago
- Dynamic import from an installed app by Archatas 4 years, 1 month ago
Comments