In order to serve static files, I could swear that I read on the Django documentation that I should use Apache, although I can’t find the quote now. (It might be the passage I’ve copied below under “Do the docs assume a VirtualHost?”)
My site will provide an interface to an economic model. A user will enter changes to the tax code, and then the model will generate some graphs and tables, which will reside as static files on the server until deleted a few weeks later. I want the user to be able to view the graphs and tables in the browser, as well as download them. The site will be hosted from a Debian-based Docker container on a rented bare-metal server.
Do I need Apache? If so, I’m having these questions about configuring it:
Do the docs assume a VirtualHost?
The Django docs for using Apache and modwsgi (I’m somehow not allowed to post the link, so I’ve put it in a reply after this post) include the following passage:
We recommend using a separate Web server – i.e., one that’s not also running Django – for serving media. Here are some good choices: * Nginx * A stripped-down version of Apache If, however, you have no option but to serve media files on the same Apache VirtualHost as Django, you can set up Apache to serve some URLs as static media, and others using the mod_wsgi interface to Django.
I only want to serve one site, from one Docker container. The apache docs describe a virtual host (link in reply) as the “practice of running more than one web site (such as company1.example.com and company2.example.com) on a single machine”. I’m not trying to do that. But neither am I trying to run two servers.
The Django docs for modwsgi (link in reply) tell me to “add the following options”:
WSGIDaemonProcess example.com python-home=/path/to/venv python-path=/path/to/mysite.com WSGIProcessGroup example.com
They don’t say where to add them. I’m guessing
/etc/apache2/apache2.conf? (My Docker image is based on Debian, and Debian keeps Apache config files at
The docs also don’t define the meaning of
python-home. I’m not using a virtualenv. Should I therefore just ignore that argument?
Last, I don’t have a domain yet. I’m just trying to run and view the site on my local machine for now. So what do I replace
example.com with above?