Create a project Create APP
1, the new desktop folder named: xiangmu
2, ctrl + r cmd run into the black terminal
3, find the project folder, create my project is: XM
3, re-entering the XM, create APP, I was xmapp
django-admin startproject XM
cd XM
python manage.py startapp xmapp
Modify XM in settings.py
1, vscode, pycharm can. Personally like to see.
2, modify settings.py Chinese time (usually in the 106 line)
LANGUAGE_CODE = 'zh-hans'
TIME_ZONE = 'Asia/Shanghai'
USE_I18N = True
USE_L10N = True
USE_TZ = True
3, modify the database, here with their own, it can also be used mysql
generally at 76 row
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'xmapp',
'PASSWORD':'123456',
'HOST':'localhost',
'PORT':'3306',
}
}
4. Save Ctrl + s
XM introduced mysql
XM init.py in the same directory in settings.py
import pymysql
pymysql.install_as_MySQLdb()
Save Ctrl + s