简体   繁体   English

错误:没有名为staticfiles的模块

[英]Error: No module named staticfiles

I'm newbie with django, I'm trying to deploy my project on a production server but I'm getting this error: 我是django的新手,我正在尝试在生产服务器上部署我的项目,但是我收到了这个错误:

Error: No module named staticfiles

When trying to start the server: 尝试启动服务器时:

python manage.py runfcgi host=127.0.0.1 port=8081 --settings=settings

with the fastCGI + nginx 使用fastCGI + nginx

Any idea? 任何想法?

Thanks! 谢谢!

You're probably using older version of Django. 你可能正在使用旧版本的Django。 staticfiles app has been available from version 1.3 only. staticfiles app仅适用于1.3版本。

您最有可能需要使用setuptools升级您的django版本

sudo easy_install --upgrade django

I just remove the whole server and installed everything again, that solved everything. 我只是删除整个服务器并再次安装所有内容,这解决了所有问题。 Seems I got some old django ghost installation or something 似乎我得到了一些旧的django幽灵装置或什么的

Sorry and thanks! 对不起,谢谢!

FYI - I just ran into this error. 仅供参考 - 我刚刚遇到这个错误。 The default Django for the system is 1.2.1 and I am using Django 1.3 in a virtualenv. 系统的默认Django是1.2.1,我在virtualenv中使用Django 1.3。 I was getting the error because I had forgotten to activate my virtualenv so it was trying to use the system Django. 我得到了错误,因为我忘了激活我的virtualenv所以它试图使用系统Django。

Another way this error could occur; 此错误可能发生的另一种方式; is that you call ./manage.py even if your in the correct virtualenv. 是你打电话给./manage.py即使你是在正确的virtualenv。 For some reason it uses the system python as supposed to the virtualenv one. 出于某种原因,它使用系统python作为virtualenv应用程序。

The correct syntax is: 正确的语法是:

python manage.py <command>

I hope this saves someone some time. 我希望这能节省一些时间。

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

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