I am attempting to deploy my Django application onto production with Apache+mod_wsgi, but encountering troubles withs static files. For whatever reason {{ STATIC_URL }} isn't being identified by my templates being produced. In development my static files possess the URL:

<script type="text/javascript" src="/static/js/myfile.js"></script>

however in production the URL is:

<script type="text/javascript" src="js/myfile.js"></script>

After I attempt to print {{STATIC_URL}} it's blank being produced. What shall we be held missing here?

Thanks!

Just discovered this attempting to solve this issue myself. The important thing step for me personally was that my sights had been passed a Context as opposed to a [cde] object. To resolve this, where I had been while using RequestContext method, I needed to supply the following third parameter:

render_to_response

Your condition was clearly solved, but case just in case another person incurs exactly the same problem.

Is mod_wsgi utilizing the same python as the spend? And also the same PYTHONPATH?

I would recommend to test another web server, simply to determine if it is a mod_wsgi problem or it's an issue with your setup/atmosphere. Gunicorn is extremely easy to setup. For doing things:

  • context_instance=RequestContext(request)
  • add pip install gunicorn for your INSTALLED_Applications
  • run the development server with gunicorn