Skip to content Skip to sidebar Skip to footer

Error In Linking Static Files In Django Project Deployed On Pythonanywhere

I have deployed a django(1.7) project in pythonanywhere and its link is- http://drchitradhawle.pythonanywhere.com/ I guess there is the problem with static file linking and bootst

Solution 1:

The reason why your static files don't work is because your static files is set to home/DrChitraDhawle/website/webpage/static in the webtab screenshot. It should be /home/DrChitraDhawle/website/webpage/static

The error logs are old (ie. you probably have not generated any new errors since you've last fixed the old ones)

Solution 2:

three things I would look into.

  1. your error log says: "The SECRET_KEY setting must not be empty" -- you should investigate whether this is still an issue. Look for SECRET_KEY in settings.py.

  2. in settings.py, the only two settings you really need are STATIC_URL and STATIC_ROOT. STATIC_ROOT should be a folder that is separate from your app folders, so I would put it somewhere like /home/DrChitraDhawle/website/. I recommend deleting the STATICFILES_DIR setting.

Then you will need to run the collectstatic command, which tells django to copy all your static files from each app into your STATIC_ROOT folder:

python manage.py collectstatic

That will copy your static files from the webpage/static folder into the website/static folder, and you will need to re-run it whenever you add or remove static files.

There's more information on the PythonAnywhere wiki, here: https://www.pythonanywhere.com/wiki/DjangoStaticFiles and in the django documentation, here: https://docs.djangoproject.com/en/1.7/howto/static-files/

Post a Comment for "Error In Linking Static Files In Django Project Deployed On Pythonanywhere"