Where is the admin template?

In Django, because the built-in admin panel and do not need to configure anything? Here on the computer, locally everything is displayed correctly, and with the deploe, the design disappears. What where you need to look, add?

  • The problem with statics, css files are not loaded. What server do you have for static? nginx? - Ivan Semochkin
  • @Baterson - doing on https://www.pythonanywhere.com/ - titov_andrei

2 answers 2

For deployment you need to collect all the static in one place, in settings.py specify the following:
STATIC_ROOT = os.path.join(BASE_DIR, "static")
And then python manage.py collectstatic
This command will copy the entire project statics to the folder created above. In the web server settings, you need to specify the path to it.
Server settings for pythonanywhere.com, taken from the official guide:

Finally, set up a static files for you.
Go to the web tab on the PythonAnywhere dashboard
Go to the Static Files section
Enter the same URL as STATIC_URL in the url section (typically, / static /)
Enter the path from STATIC_ROOT into the path section (the full path, including / home / username / etc)
Then you can retrieve a known static file. Eg, if you have a file at /home/myusername/myproject/static/css/base.css, go visit http://www.your-domain.com/static/css/base.css

Hyde with off. the site

    On pythonanywhere.com (or heroku for example ), it’s convenient to use whitenoise every time you don’t run collectstatic.

    Just add in settings.py:

     MIDDLEWARE_CLASSES = [ # 'django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', # ... ]