How to run a local project in live configuration¶
The Local, Test and Live server environments are as identical as possible, to help guarantee that your applications will run in just the same way across all of them.
However, there are a few differences. See Default project conditions for the default configuration in each environment.
Occasionally, you may wish to run the local server in a configuration closer to the live set-up. A few steps are needed to achieve this.
Set a couple of environment variables in the file .env-local
:
DEBUG=False
STAGE=live
Gather static files to be served, using collectstatic
. Run:
docker-compose run --rm web python manage.py collectstatic
Use the production web server (using uWSGI, and serving static files) rather than the Django runserver. In the docker-compose.yml file, change:
command: python manage.py runserver 0.0.0.0:80
to:
command: start web
Now when you start the local server, it will behave more like the live server.