Selenium学习--0

参考链接Python测试驱动开发

Q:参考链接命令无法创建django程序
A:命令修改

# 原命令
django-admin.py startproject superlists
# 修改成
django-admin startproject superlists

# 启动Django的开发服务器
python manage.py runserver
# 运行功能测试
python functional_tests.py
# 执行单元测试
python manage.py test

# 创建第一个数据库迁移
# 添加新字段就要创建新迁移
python manage.py makemigrations
# 查看文件夹中的内容
ls lists/migrations

# 创建真正的数据库
python manage.py migrate

# 自动清理机制--手动清理,需先关闭server
rm db.sqlite3
python manage.py migrate --noinput

# 命令更新版
# 运行功能测试---functional_test为功能测试py文件夹
python manage.py test functional_tests
# 运行单元测试---lists为单元测试py文件夹
python manage.py test lists

# 会还原所有没提交的改动
git reset --hard

# 把分散在各个应用文件夹中的静态文件夹集中起来
# 首先在setting.py文件中 在STATIC_URL = '/static' 后添加
STATIC_ROOT = os.path.abspath(os.path.join(BASE_DIR, '../static'))
# 命令窗口输入
python manage.py collectstatic

Django中的ORM功能教程

posted @ 2023-10-31 09:50  CestLaVie0019  阅读(19)  评论(0)    收藏  举报