django Learning 02: Action

[Create] project

django-admin startproject project name

【Startup project】

- The default start port 8000: Python manage.py the runserver 
- defined port is listening: Python manage.py the runserver 8080

[Create] Application

python manage.py startapp application name

DEFINITIONS View

- Define trying to function in view.py, included in the urls.py

from django.urls import path

from . import views urlpatterns = [ path('', views.index, name='index'), ]

- Add to Route Project

from django.contrib import admin
from django.urls import include, path urlpatterns = [ path('polls/', include('polls.urls')), path('admin/', admin.site.urls), ]

[Configuration Database]

--mongodb: modify the project settings.py content

DATABASES = {
'default': {
'ENGINE': None
}
}

 

Guess you like

Origin www.cnblogs.com/xasz/p/11145053.html