django, , , .
.py Installed_app :
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'preview.apps.PreviewConfig',
]
urls.py URL:
from django.conf.urls import url,include
from django.contrib import admin
urlpatterns = [
url(r'^$', include ('preview.urls')),
url(r'^admin/', admin.site.urls),
]
after that you can make a python file in the preview folder and call it urls.py.and there you should define your url patten for your preview application.
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', IndexView.as_view()),
]
The final step is to define the views. To do this, go to views.py in the preview folder and run view.py
from django.views.generic import TemplateView
class IndexView(TemplateView):
template_name = "index.html"
source
share