Serving staticfiles

15 views
Skip to first unread message

Soumen Khatua

unread,
Jun 18, 2019, 3:39:05 PM6/18/19
to django...@googlegroups.com
 Hi Folks,
After run python manage.py collrctststic all the static files copied into project_root specified folder. But after doing debug = false,the images and Css files link is not working and showing 404 error message in console. But when I did debug = True it's url and everything working properly. I'm using django 1.11 so I also added {% load staticfiles %} 

 <link rel = style... href ={% "static ' css/style.css' " %} >
I'm using loacal machine server(python manage.py runserver) yjen what is problem in this case??? 


Please help guys. 

Thank You. 

Andréas Kühne

unread,
Jun 18, 2019, 3:57:47 PM6/18/19
to django...@googlegroups.com
Hi,

The default way to do staticfile deployment in production is first of all to run collectstatic. Then change debug to false. But in doing so, django no longer serves the staticfiles, so you need to setup a http server infront of django (nginx or apache). Read here about the settings:

And then you can get a guide how to setup nginx and django here:

Regards,

Andréas


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPUw6WZZLnWc3K%3DinjD1j4v0Bp56iGOkama9Yy4w28qeqtuA4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages