Forums

Django static files in local development vs pythonanywhere

I'm sort of a newb web developer, but experienced programmer.

I was able to get a local project app to work fine with manage.py runserver. When I cloned this repository into PythonAnywhere, none of my static files showed up. I googled around and tried various solutions offered.

I changed my STATIC_URL variable, ran manage.py collectstatic successfully, but I still have a problem. collectstatic dropped everything in /home/user/project/static, which I gather is what it was supposed to do. But my templates reference, ex., {% static 'app/style.css' %} because the Django docs told me to put everything in project/app/static/app. So now the pythonanywhere server can't find the files in /home/user/project/static/app because that folder doesn't exist.

What am I missing? What steps can I take to have the same directory structure locally and on the pythonanywhere server to make both work? I am fine with changing settings.py, but changing my templates seem a bit much.

Thanks

Oh, nevermind. I misunderstood the instructions here: https://help.pythonanywhere.com/pages/DjangoStaticFiles/ I had the mapping wrong. Now everything works in both places.

Excellent, glad you worked it out :-)