我有一个中等大小的网站,但当我启动Runserver并准备运行应用程序时,需要大约30秒钟的时间。如果我选择“运行”应用程序而不是“调试”,启动时间只需要约3秒钟。
有哪些方法可以加快代码更改和调试周期呢? 我使用一台配置不错的MBP,拥有16GB的RAM。因此硬件不是问题。
我已将/media文件从项目中排除。 我没有其他大量文件会导致索引问题 我同时使用Postgres和Mongo db。 我正在运行Django 1.7 + 十多个类似的软件包:
dj-static==0.0.6
django-annoying==0.8.1
django-appconf==1.0.1
django-bootstrap-form==3.2
django-bootstrap-pagination==1.5.1
django-compressor==1.5
django-extensions==1.5.5
django-filter==0.10.0
django-guardian==1.2.5
django-storages-redux==1.2.3
django-widget-tweaks==1.3
djangorestframework==3.1.2
django-jinja==1.4.1
这是调试输出:
/Users/user1/.virtualenvs/env-test/bin/python "/Applications/PyCharm 4.5 EAP.app/Contents/helpers/pydev/pydevd.py" --multiproc --save-signatures --client 127.0.0.1 --port 64097 --file /Users/user1/gitroot/website1/manage.py runserver 0.0.0.0:8000 --verbosity 2
Connected to pydev debugger (build 141.1245)
pydev debugger: process 63926 is connecting
pydev debugger: process 63954 is connecting
Performing system checks...
System check identified no issues (0 silenced).
You have unapplied migrations; your app may not work properly until they are applied.
Run 'python manage.py migrate' to apply them.
June 03, 2015 - 09:08:52
Django version 1.7.7, using settings 'myproject.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
更新: 自此帖发布以来,Pycharm已经具备了使用Cython作为解释器的功能。我认为这在一定程度上改善了事情。我还转而使用Runserverplus,我认为它运行更快。