玩蛇网提供最新Python编程技术信息以及Python资源下载!

Django导入settings文件报 No module named djcelery什么原因

Traceback (most recent call last):
  File "D:/programs/Projects/cute_project/server/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "D:\programs\python27\lib\site-packages\django\core\management\__init__.py", line 453, in execute_from_command_line
    utility.execute()
  File "D:\programs\python27\lib\site-packages\django\core\management\__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "D:\programs\python27\lib\site-packages\django\core\management\__init__.py", line 263, in fetch_command
    app_name = get_commands()[subcommand]
  File "D:\programs\python27\lib\site-packages\django\core\management\__init__.py", line 109, in get_commands
    apps = settings.INSTALLED_APPS
  File "D:\programs\python27\lib\site-packages\django\conf\__init__.py", line 53, in __getattr__
    self._setup(name)
  File "D:\programs\python27\lib\site-packages\django\conf\__init__.py", line 48, in _setup
    self._wrapped = Settings(settings_module)
  File "D:\programs\python27\lib\site-packages\django\conf\__init__.py", line 134, in __init__
    raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'server.settings' (Is it on sys.path?): No module named djcelery

http://xianglong.me/article/django-importError-could-not-import-settings/

注意最后一句:

ImportError: Could not import settings 'server.settings' (Is it on sys.path?): No module named djcelery

你是用apache启动的么?如果是的话,很有可能是Django项目所在目录权限设置有问题,apache中,如果配置文件中Listen定义的是默认的80端口(或1024以下),那么启动Apache将需要root权限以将它绑定在特权端口上。一旦服务器开始启动并完成了一些诸如打开日志文件之类的准备操作,它将创建很多子进程来完成一些诸如侦听和回应客户端请求的工作。httpd主进程仍然以root用户的权限运行,而它的子进程将以一个较低权限的用户运行。所以你需要给文件赋予权限。还有一种可能是apache中配置文件找不到settings文件,你需要先在settings中写好文件绝对路径,然后在apache的httpd.conf,添加项目的静态路径。

玩蛇网文章,转载请注明出处和文章网址:https://www.iplaypy.com/wenda/wd19203.html

相关文章 Recommend

玩蛇网Python互助QQ群,欢迎加入-->: 106381465 玩蛇网Python新手群
修订日期:2017年05月21日 - 21时48分34秒 发布自玩蛇网

您现在的位置: 玩蛇网首页 > Python问题解答 > 正文内容
我要分享到:

必知PYTHON教程 Must Know PYTHON Tutorials

必知PYTHON模块 Must Know PYTHON Modules