Getting HTTP 301 on static resources

63 views
Skip to first unread message

jtaylor___

unread,
May 19, 2020, 1:39:14 AM5/19/20
to Django users
I'm setting up a Django instance running with gunicorn, behind Apache.  Running on the server, the initial page comes up at http://server_host/dj/, but all the static resources give a Status Code "301 Moved Permanently".  Here's an example URL: http://server_host/dj/static/app_name/bootstrap/css/app_name-bootstrap.min.css.

In PyCharm with "manage.py runserver", the initial page loads and the same static resource (http://127.0.0.1/static/app_name/bootstrap/css/app_name-bootstrap.min.css) loads fine.

I spent a while on Google, but I guess I don't know how to properly write the search to find a solution. 

Any suggestions?  TIA

Andréas Kühne

unread,
May 19, 2020, 1:19:33 PM5/19/20
to django...@googlegroups.com
You need to configure apache correctly and set up your static url in django.

See here for an explanation:

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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/46757a62-69d5-46fb-a259-23d92e796783%40googlegroups.com.

jtaylor___

unread,
May 19, 2020, 1:39:52 PM5/19/20
to Django users
Unfortunately, my Apache doesn't support wsgi.  I'm using ProxyPass in Apache.  It's working to bring back the pages, just not the static content like CSS & JS.

jtaylor___

unread,
May 19, 2020, 5:59:26 PM5/19/20
to Django users
Someone suggested to have Apache handle the static content, and that solved my problem.

Thank you
Reply all
Reply to author
Forward
0 new messages