博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

python 开发日常

Posted on 2022-05-22 20:32  pencilCool  阅读(32)  评论(0编辑  收藏  举报

环境配置

python3 -m venv venv/
source venv/bin/activate
pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com

// https://stackoverflow.com/questions/24764549/upgrade-python-packages-from-requirements-txt-using-pip-command
pip install --upgrade --force-reinstall -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
// You can also ignore installed package and install the new one :
pip install --ignore-installed -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com

django

python3 -m pip install django
django-admin startproject mysite
python3 manage.py runserver 0.0.0.0:8000
django-admin startapp firstapp

python3 manage.py migrate
python3 manage.py createsuperuser