Issue in (that created by PAW for Django)


I fond that in default "" is 2 lines with this code: "from django.contrib.staticfiles.urls import staticfiles_urlpatterns"

This are the second and the last strings, they both are commented by default.

Hi, those two lines are there to serve static files from Django apps - you should uncomment them if you need static files, eg CSS or images... We tried to explain that with a comment...

# Uncomment these two lines to enable your static files on PythonAnywhere
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns += staticfiles_urlpatterns()

It's not a perfect solution, in future we hope to have /var/www/static as a default directory from which static content will be served automatically.

Does that answer your question?

Hmm... May be it is stupid question, but why have we 2 imports of "staticfiles_urlpatterns" ? Is this a kind of insurance from user or something so?

P.S. sorry for bothering

There should only be 1 import. I'm not quite sure how that happened... Maybe it could happen if you click the 'quick start' button twice, using the same target folder...

I am not sure why it happened, but take a look please: There are 2 imports in tutorial too! However, I created another django app and now is correct.

You're right, that's definitely an error in our tutorial! We'll fix it, the first one is definitely unnecessary.