Please check the docs. It should help!
include()
function takes a list/tuple of url()
, path()
, re_path()
and includes them to django routing system.
It also requires app's name: you can define it in include(("enter here your app's name", app.urls))
or in an app itself, in urls.py at a modular level. app_name = 'enter here your apps'name '
But only include()
isn't enough, you have to define it in path()
or smth that is used for routing (e.g re_path()
, url()
(deprecated in django 2.0))
For full details: include()
function.
So, the full poiting to app's urls look so:
from django.conf.urls import url, include
from . import views
from . import app
urlpatterns = [
url(r'^', include(("app", app.urls)), name='index'),
]
I recommend you to use path()
and re_path()
if you use Django 2.0 >
I noticed that you use regex incorrectly little bit
url(r'^$/', views.index, name='index'),
You type $
before /
, it's incorrect, $
means the end of expression and must be used in the end of expression.
Unfortunately I can't tell you all the details in the post. You should read Django docs. Go through django tutorial for start.
I'm sure it will help!