Django - Static file not found

前端 未结 13 777
旧巷少年郎
旧巷少年郎 2020-11-30 20:46

I\'ve seen several posts for this issue but didn\'t found my solution.

I\'m trying to serve static files within my Django 1.3 development environment.

Here a

13条回答
  •  时光取名叫无心
    2020-11-30 21:10

    There could be only two things in settings.py which causes problems for you.

    1) STATIC_URL = '/static/'

    2)

    STATICFILES_DIRS = (
        os.path.join(BASE_DIR, "static"),
    )
    

    and your static files should lie under static directory which is in same directory as project's settings file.

    Even then if your static files are not loading then reason is , you might have kept

    DEBUG = False
    

    change it to True (strictly for development only). In production just change STATICFILES_DIRS to whatever path where static files resides.

提交回复
热议问题