Static and Media Files in Django
Setup Instructions
-
Clone down the repo
-
Create and activate a virtual environment
-
Install the dependencies:
$ pip install -r requirements.txt
-
Apply the migrations:
$ python manage.py migrate
Development Example
$ python manage.py runserver
Production Example
-
Set
DEBUG
toFalse
in the settings.py file -
Then, collect the static files and run Gunicorn:
$ python manage.py collectstatic $ gunicorn core.wsgi:application -w 1
This uses WhiteNoise to serve up the static files, so you'll need to add Nginx in order to handle media files appropriately.