gunicorn media file serving
This commit is contained in:
parent
d09c6dbfed
commit
f9cb44c66b
@ -7,6 +7,10 @@ ALLOWED_HOSTS=*
|
|||||||
# random secret key, use for example base64 /dev/urandom | head -c50 to generate one
|
# random secret key, use for example base64 /dev/urandom | head -c50 to generate one
|
||||||
SECRET_KEY=
|
SECRET_KEY=
|
||||||
|
|
||||||
|
# serve mediafiles directly using gunicorn, technically not a "best practice" but for the expected small deployments
|
||||||
|
# of this application absolutely sufficient. If False some kind of webserver (for example nginx) is needed to server mediafiles
|
||||||
|
GUNICORN_MEDIA=True
|
||||||
|
|
||||||
# add only a database password if you want to run with the default postgres, otherwise change settings accordingly
|
# add only a database password if you want to run with the default postgres, otherwise change settings accordingly
|
||||||
DB_ENGINE=django.db.backends.postgresql_psycopg2
|
DB_ENGINE=django.db.backends.postgresql_psycopg2
|
||||||
POSTGRES_HOST=db_recipes
|
POSTGRES_HOST=db_recipes
|
||||||
|
7
.idea/dictionaries/vabene1111_PC.xml
Normal file
7
.idea/dictionaries/vabene1111_PC.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<component name="ProjectDictionaryState">
|
||||||
|
<dictionary name="vabene1111-PC">
|
||||||
|
<words>
|
||||||
|
<w>gunicorn</w>
|
||||||
|
</words>
|
||||||
|
</dictionary>
|
||||||
|
</component>
|
@ -21,6 +21,8 @@ SECRET_KEY = os.getenv('SECRET_KEY') if os.getenv('SECRET_KEY') else '728f4t5438
|
|||||||
|
|
||||||
DEBUG = bool(int(os.getenv('DEBUG', True)))
|
DEBUG = bool(int(os.getenv('DEBUG', True)))
|
||||||
|
|
||||||
|
GUNICORN_MEDIA = bool(int(os.getenv('GUNICORN_MEDIA', True)))
|
||||||
|
|
||||||
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS').split(',') if os.getenv('ALLOWED_HOSTS') else ['*']
|
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS').split(',') if os.getenv('ALLOWED_HOSTS') else ['*']
|
||||||
|
|
||||||
LOGIN_REDIRECT_URL = "index"
|
LOGIN_REDIRECT_URL = "index"
|
||||||
|
@ -25,5 +25,5 @@ urlpatterns = [
|
|||||||
path('i18n/', include('django.conf.urls.i18n')),
|
path('i18n/', include('django.conf.urls.i18n')),
|
||||||
]
|
]
|
||||||
|
|
||||||
if settings.DEBUG:
|
if settings.GUNICORN_MEDIA or settings.DEBUG:
|
||||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
Loading…
Reference in New Issue
Block a user