Search code examples
pythondjangopythonanywherestatic-filesweb-publishing

css static file in pythonanywhere not found


I understand that the topic was not raised once, I reread and tried all the options, but for some reason the error does not go away and the styles do not connectenter image description here

connect static

path directory

error in load site

path in templates


Solution

  • On your own local system static files will be served by the django dev server. In a production setting like PythonAnywhere, you need to set the STATIC_ROOT in your settings.py, eg: /home/yourusername/myproject/static

    and then run python manage.py collectstatic which will collect static files from your app folders and put them in there