0
votes

I am a little confused about the Django development server. Here the question is if my project running based on gunicorn and Nginx in production environment.

Should my local development need Nginx for serving static files?

if yes then what command should I use instead of Python manage.py runserver.

Help me get out of it.

1
Do you set all static variable in setings.py for your local run? - MK Patel
yes i do set it ,but what about images that upload by users in the storage like s3 bucket... - lookesh
You have to manage all variable related to media in setttings.py - MK Patel

1 Answers

0
votes

For static file, you have to manage below variables in your settings.py

STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/'
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'your_app_name/static')
]

For media related thing you have to set below variables in your settings.py

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')