pip install virtualenv
pip install virtualenvwrapper # 这是对virtualenv的封装版本,一定要在virtualenv后安装
virtualenv -p python django-inside-dev # 创建名字为django-inside-dev的虚拟环境
cd djanog-inside-dev
cd Scripts # 或 C:\virtualenv\django-inside-dev\Scripts\ 加入环境变量
activate # 启动虚拟环境
deactive # 退出虚拟环境
cd C:\virtualenv
# fork一下官方源码djagno
git clone --branch 2.2.4 git@github.com:ni-ning/django.git
git checkout -b resource-comment
git add .
git commit -m 'first step to read django code'
# 虚拟环境下源码安装
python setup.py install
# Pycharm 配置选择该虚拟环境下的Python解释器
# 打开Pycharm的Terminal自动进入activate环境
Pycharm打开虚拟环境django-inside-dev/site-packages的django源码,在Pycharm的命令行模式可以随时修改随时调试,爽歪歪
django/django
- apps # class AppConfig / class Apps
- bin # django-admin -> management.execute_from_command_line()
- conf # global_settings.py
- contrib
|- admin # resister
|- auth # authenticate,login,logout,get_user_model,get_user
|- sessions # Session
- core
|- cache
|- mail
|- serializers
- db
|- models # class Signal
- forms
- http # HttpRequest, HttpResponse, Http404, SimpleCookie
- middleware
- template
- templatetags
- test
- urls # path, re_path, include
- utils
- views
- shortcuts.py