Forums

Django and static files

Hey,

I'm trying to get my app up and running. The one thing I'm having a bit of trouble with is getting the static files for the admin page served. Everything works fine on my localhost but not on pythonanywhere.

I mapped the static URLs on the web app page as follows:

/static/admin/ ---> /home/vikramm/.virtualenvs/<virtualenv name>/lib/python2.7/site-pack ages/django/contrib/admin/static/admin/

I did the following for the static files for my app and it works fine: /static/ ---> /home/vikramm/<project directory>/static/

Is there something that I'm missing?

Thanks for your help.

Vikram

Have a look in your browser developer tools when you load the page and see what is happening with the requests. My guess is that the admin UI is not requesting its static files from /static/admin

Thanks Glenn, for the reply.

I had checked and it was indeed requesting from /static/admin. Not sure what was wrong, but I just deleted the URL and directory, reentered it, and reloaded the site and it worked...

That's odd! Well, I'm glad it's working now, and thanks for letting us know.