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 static
、mkdir -p templates
4. Modify the project folder setting.py file
vim setting.py
- Registration APP
INSTALLED_APPS = ['app01',]
- Add
ALLOWED_HOST = ['*']
all IP can access - TEMPLATES was added template path
'DIRS': [os.path.join(BASE_DIR, 'templates')],
- 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