Django admin static files deployment Pythonanywhere

undefined_karani

ian-veteran

Posted on November 6, 2024

Django admin static files deployment Pythonanywhere

Debugged Admin panel pain cross fingers so as it works
Pythonanywhere: https://iankarani.pythonanywhere.com/admin/login/?next=/admin/

Install module whitenoise: https://whitenoise.readthedocs.io/en/latest/

Django admin templates: https://github.com/django/django/tree/main/django/contrib/admin/templates/admin

Procedure:
1: Install whitenoise support Django4.2 - 5.1

  • Update the middleware in the project settings

  • Proceed to the static make the following changes adding STATIC_ROOT and STATICFILES_STORAGE

Image description

2: The run

python manage.py collectstatic
Enter fullscreen mode Exit fullscreen mode

3: Runserver

python manage.py runserver
Enter fullscreen mode Exit fullscreen mode

Ensure you template folder doesn’t miss the html files:

  • base_site.html

  • color_theme_toggle.html
    Image description

💖 💪 🙅 🚩
undefined_karani
ian-veteran

Posted on November 6, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related