Jake Z
Jake Z

Reputation: 1133

Django and SSL Server

I'm using a Django-SSLServer add-on with my Django app. As found at: here

For some reason when I run the server (using PyCharm), my static content doesn't render properly (if at all!). However, when I run the built in HTTP server, it renders the static files fine.

How can I re-route my site so that static works for HTTPS? I'm using the built in server with Django.

Thanks!

Upvotes: 2

Views: 1134

Answers (1)

Hevlastka
Hevlastka

Reputation: 1948

Within your urls.py you should map your static path ie:

url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root':   settings.STATIC_ROOT}),

or alternatively,

from django.conf import settings
...
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
    {'document_root': settings.STATIC_DOC_ROOT}),

This should render your settings files while DEBUG=False

Hope this helps!

Upvotes: 1

Related Questions