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)),
)