PythonのDjangoでサクッとサーバーを動かそうとしたら、エラーが出た。。。
$ python manage.py runserver
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7fe3e6f87bf8>
Traceback (most recent call last):
File "/usr/bin/.pyenv/versions/3.6.4/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/usr/bin/.pyenv/versions/3.6.4/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 120, in inner_run
self.check(display_num_errors=True)
File "/usr/bin/.pyenv/versions/3.6.4/lib/python3.6/site-packages/django/core/management/base.py", line 410, in check
raise SystemCheckError(msg)
django.core.management.base.SystemCheckError: SystemCheckError: System check identified some issues:
ERRORS:
?: (staticfiles.E002) The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting.
STATICFILES_DIRSの設定がSTATIC_ROOTの設定と重複してるよーって怒られた。。。
早速対処。
mySite/setting.py
・
・
・
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "static/")
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static"),
)
↓
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "static/")
#STATICFILES_DIRS = (
# os.path.join(BASE_DIR, "static"),
#)
STATICFILES_DIRSの箇所をコメントアウト。
再度サーバーを起動したら動いた。
$ python manage.py runserver