Django: STATIC_URL adds appname to the url

后端 未结 1 1525
慢半拍i
慢半拍i 2021-01-14 21:06

I have configured my static settings like so:

STATIC_ROOT = os.path.join(SITE_ROOT, \'static\')
STATIC_URL = \'/static/\'
STATICFILES_DIRS = (
    (\'js\', o         


        
相关标签:
1条回答
  • 2021-01-14 21:15

    Since you're using the django built-in developement server, try to remove the following line from your urls.py:

    urlpatterns += staticfiles_urlpatterns()
    

    In production, you'de better not serve static files with django, so use the collectstatic command.

    edit

    If settings.py, try something like this:

    STATIC_ROOT = os.path.join(os.path.dirname(__file__), '../../static')
    STATIC_URL = '/static/'
    
    0 讨论(0)
提交回复
热议问题