ERRORS: ?: (staticfiles.E002) The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting.


Ubuntu下,運行django項目的時候失敗,報錯:

(env36) root@JD:~/xueyiwang# python manage.py runserver 0.0.0.0:8000 
Performing system checks...

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f47dd74a950>
Traceback (most recent call last):
  File "/root/env36/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "/root/env36/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 120, in inner_run
    self.check(display_num_errors=True)
  File "/root/env36/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.

錯誤原因有可能是在settings中靜態文件目錄設置的有問題

STATIC_ROOT=os.path.join(BASE_DIR,"static/")#錯誤
STATIC_ROOT=os.path.join(BASE_DIR,"/static/")#正確

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM