CentOS7 created Django project

1. (New Folder used to store items) to enter the specified folder, create a Django project

django-admin.py startproject mysite
mysite as the project name

2. Go to the project folder, the new app

python manage.py startapp app01
app01 for the app name

3. New Folder static and templates

mkdir -p staticmkdir -p templates

4. Modify the project folder setting.py file

vim setting.py

  1. Registration APP INSTALLED_APPS = ['app01',]
  2. Add ALLOWED_HOST = ['*']all IP can access
  3. TEMPLATES was added template path 'DIRS': [os.path.join(BASE_DIR, 'templates')],
  4. Add a static file path
STATICFILES_DIRS = (
os.path.join(BASE_DIR,'static'),
)

5. Complete the project (configuration URL, modify views.py, add template files, etc.)

6. Start project

python manage.py runserver


more specifically

More articles about Django

Guess you like

Origin www.cnblogs.com/dbf-/p/11031872.html