4
You should look inside the main urls.py
file of your project (e.g. the one settings.ROOT_URLCONF
points to, not the one inside the individual apps)
In that main urls.py
you will see an entry that maps the urls of your myapp
to the URL path myapp/
.
You can replace that with something like this:
url(r'^$', 'myapp.urls')
Which will put all the urls under myapp
, on the top level path, so you won’t need to use myapp/
Edit
You can also map bigduck
in your main urls.py
, e.g.
bigduck/ -> myapp.bigduck
register/ -> register
but what I meant in my comment is that the order in which the regex of URLs appear in your urls.py
file is important, because Django will stop at the first match, that’s why all your URLs are mapped to the myapp
Look at number 3 here https://docs.djangoproject.com/en/dev/topics/http/urls/#how-django-processes-a-request
4
Update 2019 / django >= 2.0
Edit your main urls.py
– the one in the same directory as your settings.py
file.
urlpatterns = [
# updated so we don't need the myapp prefix
# path('myapp/', include('myapp.urls')), # old version
path('', include('myapp.urls')),
path('admin/', admin.site.urls),
]
- [Django]-Is it possible to include a custom 404 view for a Django app without changing anything at the project level?
- [Django]-Pyapns Fault 500: 'Connection to the APNS server could not be made
- [Django]-MySQL database being hit too many times with django query