用于Django的python3 manage.py runserver

时间:2016-05-16 18:23:46

标签: python django settings manage.py

我无法运行Django服务器,这就是问题所在:

MacBook-Pro-di-viv:vivsite viv$ python3 manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.5/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute()
 File "/usr/local/lib/python3.5/site-packages/django/core/management/__init__.py", line 303, in execute
settings.INSTALLED_APPS
 File "/usr/local/lib/python3.5/site-packages/django/conf/__init__.py", line 48, in __getattr__
self._setup(name)
 File "/usr/local/lib/python3.5/site-packages/django/conf/__init__.py", line 44, in _setup
self._wrapped = Settings(settings_module)
 File "/usr/local/lib/python3.5/site-packages/django/conf/__init__.py", line 92, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
 File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/__init__.py", line 121, in import_module
raise TypeError(msg.format(name))
TypeError: the 'package' argument is required to perform a relative import for '.settings'

在此Python命令行之后我遇到了这个问题:

>>> settings.configure()

有人能帮助我吗?谢谢!

1 个答案:

答案 0 :(得分:0)

我认为您的设置文件名为“.settings.py”。

您是否尝试重命名,而不是以“。”开头。 ?