[Fixed]-How to import Django main project urls file from separate app?

1👍

For example, the “django-allauth” app is completely independent, and it has a urls.py file. So in you settings.py, you load the app:

INSTALLED_APPS = (
    ...,
    'django-allauth',
    ...,
)

and then in your project’s urls.py you include the app’s urls:

urlpatterns = [
    ...,
    url(r'^accounts/', include('allauth.urls')),
    ...,
]

See the Django basic Tutorial:

https://docs.djangoproject.com/en/1.9/intro/tutorial03/

👤C14L

0👍

If you simply want to import the file, and assuming you have the app installed correctly, then you should just be able to do

from myproject import urls

Leave a comment