1避免Anaconda与Python3.9环境变量冲突,删除前者
C:\ProgramData\Anaconda3C:\ProgramData\Anaconda3\Library\usr\binC:\ProgramData\Anaconda3\Library\binC:\ProgramData\Anaconda3\ScriptsC:\ProgramData\Anaconda3\Library\mingw-w64\bin
2常用命令
### 查看指定包的所有版本pip install django==### 常用迁移命令migrate,负责应用和撤销迁移makemigrations,基于模型的修改创建迁移sqlmigrate,展示迁移使用的 SQL 语句showmigrations,列出项目的迁移和迁移的状态#### 版本控制,起别名python manage.py makemigrations --name changed_my_model your_app_label### 新增迁移,reference [https://docs.djangoproject.com/zh-hans/3.2/ref/django-admin/#cmdoption-migrate-fake-initial]migrate --fake-initialmigrate --check#### 撤销迁移python manage.py migrate books 0002#### 撤销所有迁移python manage.py migrate books zero#### 压缩迁移./manage.py squashmigrations myapp 0004#### 进入项目下的python模块# 路径:(Test) PS C:\Users\41999\Documents\projectmanagement\Test\Scripts\whereabouts>python manage.py shell
3 Windows下找不到命令
删除环境变量
%USERPROFILE%\AppData\Local\Microsoft\WindowsApps
4. 重装pip
1. 报错Fatal error in launcher: Unable to create process using '"C:\Users\41999\Documents\????\Test\Scripts\python.exe" "C:\Users\41999\Documents\projectmanagement\Test\Scripts\pip.exe" list': ???????????2. 解决策略---重装ippython -m pip install --upgrade --force-reinstall pip3. 参考文档https://www.huaweicloud.com/articles/bfe39b5ade71bc14c785b283f390e17a.html
5. 查询语句以及数据删除
1. SQL查询的显示https://docs.djangoproject.com/zh-hans/3.2/faq/models/#how-can-i-see-the-raw-sql-queries-django-is-running2. 数据库删除操作https://docs.djangoproject.com/zh-hans/3.2/ref/django-admin/#flush
6.自动生成依赖以及直接安装所有包
pip freeze > requirements.txt# 移动文件至项目根目录,然后执行以下命令pip install -r requirements.txt
7.Pycharm如何直接换源

8. powershell查看历史命令
C:\Users\41999\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine

Powershell 查看安装位置
$PSHOME
9 vscode 更改终端字体

10 vscode 代码块
{"HEADER": {"prefix": "header","body": ["# -*- encoding: utf-8 -*-","'''","@File : $TM_FILENAME","@Time : $CURRENT_YEAR/$CURRENT_MONTH/$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND","@Author : Caesar Tylor","@Contact : caesartylor@gmail.com","@License : GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright(C) 2007 Free Software Foundation, Inc. < https: //fsf.org/>","'''","","$0"],}}
11 CSRF豁免
1. 在view视图中引入如下的包from django.views.decorators.csrf import csrf_protect2. 在view视图函数前加入该装饰器@csrf_exempt3. 来源https://docs.djangoproject.com/zh-hans/3.2/ref/csrf/
12 Pycharm设置powershell为终端
path : Tools —-> Terminal
受限的原因
已知的限制默认情况下,Windows 应用商店包在应用程序沙盒中运行,后者用于虚拟化对某些文件系统和注册表位置的访问。 对虚拟化文件和注册表位置的更改不会在应用程序沙盒外部保留。此沙盒会阻止对应用程序的根文件夹进行的一切更改。 不能修改存储在 $PSHOME 中的任何系统级配置设置。 其中包括 WSMAN 配置。 这可以防止远程会话连接到 PowerShell 的基于应用商店的安装。 支持用户级配置和 SSH 远程处理。以下命令需要写入 $PSHOME。 PowerShell 的 Microsoft Store 实例中不支持这些命令。Register-PSSessionConfigurationUpdate-Help -Scope AllUsersEnable-ExperimentalFeature -Scope AllUsersSet-ExecutionPolicy -Scope LocalMachine
13 WSL(Ubuntu2004)安装Nginx
cd /optwget http://tengine.taobao.org/download/tengine-2.3.3.tar.gztar -xvf tengine-2.3.3.tar.gzcd tengine-2.3.3./configure --prefix=/opt/nginx233make && make installvim /etc/profileexport PATH=/usr/bin:/opt/python398/bin:/opt/nginx233/sbin:$PATHsource /etc/profilehttps://blog.csdn.net/asmartkiller/article/details/114779154http://tengine.taobao.org/download.html
14 设置 Tsinghua默认源
python -m pip install --upgrade pippip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
15 前端环境配置
16 查看库函数源码
python -vimport bisectcat C:\Users\41999\AppData\Local\Programs\Python\Python310\lib\bisect.py


