toneapp/
manage.py
toneapp/
settings/
__init__.py
base_settings.py
dev_settings.py
production_settings.py
urls.py
wsgi.py
feedback/
__init__.py
admin.py
apps.py
migrations/
__init__.py
models.py
tests.py
views.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'registration',
'adminpanel',
'feedback',
]
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/root/.virtualenvs/toneapp/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/root/.virtualenvs/toneapp/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 308, in execute
settings.INSTALLED_APPS
File "/root/.virtualenvs/toneapp/local/lib/python2.7/site-packages/django/conf/__init__.py", line 56, in __getattr__
self._setup(name)
File "/root/.virtualenvs/toneapp/local/lib/python2.7/site-packages/django/conf/__init__.py", line 41, in _setup
self._wrapped = Settings(settings_module)
File "/root/.virtualenvs/toneapp/local/lib/python2.7/site-packages/django/conf/__init__.py", line 110, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named toneapp.settings
答案 0 :(得分:1)
在层次结构中,您将spring.servlet.multipart.enabled=true
,settings.py
和base_settings.py
之类的dev..
分开放置,并将它们全部放入settings文件夹。
production...
简而言之,您已经更改了Django默认层次结构,这就是错误的原因,因为Django在搜索toneapp/
settings/
__init__.py
base_settings.py
dev_settings.py
production_settings.py
。py时找不到它。最简单的解决方案是返回默认层次结构并合并toneapp/settings
中的所有设置,否则,您必须搜索并更改Django调用settings.py
的方式并将其调整为您自己的方式。
答案 1 :(得分:0)
解决方案是将 manage.py 中的“ os.environ.setdefault”更改为:
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'toneapp.settings.dev_settings')