2👍
Just use url()
instead of path()
from django.conf.urls import url, include
from django.contrib import admin
urlpatterns = [
url(r'^admin', admin.site.urls),
url(r'^moraimono/', include('moraimono.urls')),
]
Find more details in url
documentation’s here
2👍
urlpatterns
should be a list of url()
instances. :
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^index/$', index_view, name='main-view'),
url(r'^moraimono/', include('moraimono.urls')),
...
]
url()
is defined internally as:
def url(regex, view, kwargs=None, name=None):
if isinstance(view, (list, tuple)):
# For include(...) processing.
urlconf_module, app_name, namespace = view
return RegexURLResolver(regex, urlconf_module, kwargs, app_name=app_name, namespace=namespace)
elif callable(view):
return RegexURLPattern(regex, view, kwargs, name)
else:
raise TypeError('view must be a callable or a list/tuple in the case of include().')
- [Django]-Django-rest returning http 301 status code when calling http delete without trailing slash
- [Django]-Django does not render after POST request
- [Django]-Polling celery task and return on display
- [Django]-Pprint module works slowly with Django in 32bits system
0👍
use url
, you already have it imported and in django 2.0 it’s synonymous with re_path
from django.conf.urls import url
from django.conf.urls import include
from django.contrib import admin
urlpatterns = [
url(r'^'moraimono/$', include('moraimono.urls')),
url(r'^'admin/$', admin.site.urls),
]
- [Django]-Django Pagination with multiple models (tables)
- [Django]-Set GOOGLE_APPLICATION_CREDENTIALS environment variable in VSCode debugger
- [Django]-Neutral element for "|" and "&" operations for django.db.models.Q objects?
Source:stackexchange.com