Confused about static files for Django

I have a well working site on my development machine, uploaded it to pythonanywhere, and started to adjust the small details thats normally required.

But this time its problematic. I have several apps with their own "static" directory, and I am now confused as to how the normal static file sequence of search is implemented when I am using pythonanywhere.

You'll want to do three things:

  • set STATIC_ROOT in

  • run collectstatic to collect all your static files from app directories and elsewhere, and copy them into STATIC_ROOT

  • set up a static files URL on the Web tab, with the URL part as /static/ and the path part to be the same path as STATIC_ROOT.

More info in the django docs

Hi Harry, thanks for replying so fast, thats really one of the reasons for loving pythonanywhere! ;-)

Anyway, I was not following my own deployment instructions, and forget the collectstatic thing before i copied the files.

Its not completely obvious why there is no static-path finder to sites under development, why it makes perfectly sense for operational deployments. it gives a huge amount of duplicate files - instead of using a clever static-file-finder.

Thanks again

Happy to help! I think I'll add an entry to the wiki...

What do we think?