Forums

Django admin site without layout

Hi,

I've got a problem with django admin site layout. When i start my app (using my computer as server) by "python manage.py runserver" everything is ok, but when i do it in pythonanywhere server by wsgi file the layout is missed. Admin page shows correctly, but without that default admin layout. Can anyone tell me how to fix it?

Sounds like you need to set up the static file configuration -- the layout is in CSS files, and you need to tell PythonAnywhere where to find them. If you want I can take a look at your code and tell you what you need to do -- just let me know here that I'm allowed to look.

giles, you are allowed to look :D is that how it works? only this sentence as permision?

Yes, that's how it works -- obviously our systems need to be able to access your files so that we can run your code, and we need to be able to monitor the systems and fix bugs. So we decided that we'd have to have a strict policy of never looking at people's private stuff unless they give permission -- or, of course, if there's some legal reason we're forced to. Anyway, I'm taking a look now.

OK, so what you need is a mapping from the URL stub /static/ to the directory /home/clsbartek/.virtualenvs/django15/lib/python2.7/site-packages/django/contrib/admin/static. That should make the admin app pick up the appropriate CSS stuff from the appropriate place.

Hope that helps!

Thank you very much giles. You help me a lot. Thank you once again.

Hi,

I'm with the same problem but I didn't understand the solution... in "settings.py", I changed STATIC_URL = '/static/' to STATIC_URL = '/home/delvinha/.virtualenvs/django16/lib/python2.7/site-packages/django/contrib/admin/static/' but the admin site is still without CSS layout.

Can you say which part of the code I need to change to fix this?

I think you misunderstood what Giles was saying. The static URL in settings.py should still be '/static/'. You need to make a static mapping on your web app page (look under "Static files") that maps the URL '/static/' to the path '/home/delvinha/.virtualenvs/django16/lib/python2.7/site-packages/django/contrib/admin/static/'

same problem here. In what file & where to do you actually do the mapping of URL '/static/ to the path? regards

resolved: under pythonanywhere.com, go to TAB (not app) "WEB", and scroll down to see mapping section for STATIC FILES

Thanks buddy but you should explain the path meaning by using syntax or something i felt defficult to understand this first.

Our help pages describe static files in more detail: https://help.pythonanywhere.com/pages/StaticFiles/ and https://help.pythonanywhere.com/pages/DebuggingStaticFiles/

Hi. I have the same problem with my django admin. It works fine in local, but once on pyhtonanywhere, django admin get broken I don't know if I made a mistake, but I've already tried all the solutions mentioned above and it still doesn't work. Help me please Thanks

See the links that I posted in my previous message. Particularly, the one about debugging static files issues.