LoginSignup
10
5

More than 5 years have passed since last update.

Djangoのエラー「The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting.」が出たので対処した

Last updated at Posted at 2018-05-08

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
10
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
5