python - django无法导入settings文件
高洛峰
高洛峰 2017-04-17 13:48:34
0
3
1752
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
高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(3)
Peter_Zhu

Note the last sentence:

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

刘奇

Did you start it with apache? If so, it is very likely that there is a problem with the permission settings of the directory where the Django project is located. In Apache, if the Listen definition in the configuration file is the default port 80 (or below 1024), then starting Apache will require root permissions to bind it. on a privileged port. Once the server starts and completes some preparation operations such as opening a log file, it will create many child processes to complete some work such as listening and responding to client requests. The main httpd process still runs with the privileges of the root user, and its child processes will run with a lower-privileged user. So you need to give permissions to the file. Another possibility is that the settings file cannot be found in the configuration file in apache. You need to write the absolute path of the file in settings first, and then add the static path of the project in apache's httpd.conf.

黄舟

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!