savoirfairelinux / sous-chef

Sous-Chef is a web application to help organizations to plan and deliver meals, and to manage clients files.
GNU Affero General Public License v3.0
67 stars 45 forks source link

Maintenance: update dependency version. #781

Closed lingxiaoyang closed 7 years ago

lingxiaoyang commented 7 years ago

Changes proposed in this pull request:

Status

How to verify this change

Please be sure to rebuild your 'web' container.

Deployment notes and migration

N/A

New translatable strings

N/A

Additional notes

N/A

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 95.342% when pulling f7512baec8ad3bbd71d7be5b144c364f35c53f26 on lingxiaoyang:maintenance/20170717 into 26fe5eff80490acb44777f1970ad41a5d65b8e27 on savoirfairelinux:dev.

erozqba commented 7 years ago

@lingxiaoyang could you test this with and without production settings? I need to make some config changes in order to make it work:

diff --git a/src/sous_chef/settings.py b/src/sous_chef/settings.py
index 04d6c07..4516a1a 100644
--- a/src/sous_chef/settings.py
+++ b/src/sous_chef/settings.py
@@ -202,7 +202,7 @@ FORMAT_MODULE_PATH = (
 )

 # Static files (CSS, JavaScript, Images)
-# https://docs.djangoproject.com/en/1.9/howto/static-files/
+# https://docs.djangoproject.com/en/1.11/howto/static-files/
 STATIC_ROOT = os.path.join(BASE_DIR, 'static')

 STATICFILES_DIRS = (
@@ -211,9 +211,17 @@ STATICFILES_DIRS = (
 STATIC_URL = '/static/'

 # Avatar files
-MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
-MEDIA_URL = '/media/'
-AVATAR_STORAGE_DIR = 'avatars/'
+if DEBUG:
+    # When using the development server, serve files directly from /media/
+    # https://docs.djangoproject.com/en/1.11/howto/static-files/#serving-files-uploaded-by-a-user-during-development
+    MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
+    MEDIA_URL = '/media/'
+else:
+    # In non development mode, serve files from /static/ using gninx as
+    # dedicated server
+    # https://docs.djangoproject.com/en/1.11/howto/static-files/deployment/#serving-static-files-from-a-dedicated-server
+    MEDIA_ROOT = os.path.join(STATIC_ROOT, 'media')
+    MEDIA_URL = '/static/media/'
 AVATAR_PROVIDERS = (
     'avatar.providers.PrimaryAvatarProvider',
     'avatar.providers.GravatarAvatarProvider'

The main reason is that in production settings, we are using gunicorn server for python files and nginx is serving the static files, I propose to have uploaded files like images for avatars inside 'static' because we already share a volume with the static files between the web and the nginx containers.

lingxiaoyang commented 7 years ago

Replaced by #801 . Closing.