版权声明:一起学习啊 https://blog.csdn.net/q1694222672/article/details/81532509
1.首先pycharm创建python的虚拟运行环境
2.安装Django2.0
创建Django项目
3.安装mysqlclient,配置setting文件
拖入wheel文件,需要下载见另一篇博客
pip安装
修改setting文件
此时数据库
4.执行迁移,测试运行
(venv) C:\Users\Administrator\PycharmProjects\mytest\sqltest>python manage.py migrate
System check identified some issues:
WARNINGS:
?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default'
HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings in
to errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/2.0/ref/databases/#mysql-sql-mode
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying sessions.0001_initial... OK
此时数据库
测试运行
5.创建后台用户,测试运行
(venv) C:\Users\Administrator\PycharmProjects\mytest\sqltest>python manage.py createsuperuser
Username (leave blank to use 'administrator'): admin
Email address: [email protected]
Password:
Password (again):
Superuser created successfully.
此时数据库
测试