简体   繁体   English

Django部署collectstatic错误

[英]Django deploy collectstatic error

I'm trying to deploy my Python Django project on server (useing Nginx). 我正在尝试在服务器上部署Python Django项目(使用Nginx)。 But when I collect statics 但是当我收集静电时

python manage.py collectstatics

I get the next error: 我收到下一个错误:

Couldn't import Django. 无法导入Django。 Are you sure it's installed and " ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment? 您确定已安装并且“ ImportError:无法导入Django。您确定已将其安装在PYTHONPATH环境变量中并且可用吗?您忘记激活虚拟环境了吗?

But I have Django and "turned on" virtualenv 但是我有Django并且“打开”了virtualenv

pip freeze: 点冻结:

certifi==2017.4.17
chardet==3.0.4
command-not-found==0.3
Django==1.10.7
django-appconf==1.0.2
django-ckeditor==5.3.0
django-haystack==2.6.1
django-imagekit==4.0.1
django-js-asset==0.1.1
django-material==1.0.0
django-parler==1.8
flickrapi==2.3
gunicorn==19.7.1
idna==2.5
language-selector==0.1
oauthlib==2.0.2
olefile==0.44
pilkit==2.0
Pillow==4.2.1
pycurl==7.43.0
pygobject==3.20.0
python-apt==1.1.0b1
python-debian==0.1.27
python-systemd==231
pytz==2017.2
requests==2.18.1
requests-oauthlib==0.8.0
requests-toolbelt==0.8.0
requirements==0.1
six==1.10.0
solid-i18n==1.4.1
ssh-import-id==5.5
ufw==0.35
unattended-upgrades==0.1
urllib3==1.21.1
virtualenv==15.0.1
Whoosh==2.7.4

Please check you static path in nginx configuration file. 请检查您在nginx配置文件中的static路径。

location /static/ {
        alias   <static directory path>;
    }

It should be same as setting.py SETTING_ROOT path 它应该与setting.py SETTING_ROOT路径相同

STATIC_ROOT = '<static directory path>'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM