From b019c546cd91e95ccdb6a1ffede3d8d8b1397a19 Mon Sep 17 00:00:00 2001 From: Maxime Bombar Date: Sat, 7 Mar 2020 15:56:00 +0100 Subject: [PATCH 1/4] Use example.org in nginx_note.conf_example --- nginx_note.conf_example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx_note.conf_example b/nginx_note.conf_example index 1f7ce4ca..204784d0 100644 --- a/nginx_note.conf_example +++ b/nginx_note.conf_example @@ -9,7 +9,7 @@ server { # the port your site will be served on listen 80; # the domain name it will serve for - server_name note.comby.xyz; # substitute your machine's IP address or FQDN + server_name note.example.org; # substitute your machine's IP address or FQDN charset utf-8; # max upload size From 55a775427756794e6896d44e905776a1282dcc31 Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Sat, 7 Mar 2020 17:27:28 +0100 Subject: [PATCH 2/4] use localhost in dev --- note_kfet/settings/development.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/note_kfet/settings/development.py b/note_kfet/settings/development.py index ad2cd2f1..e68e9d68 100644 --- a/note_kfet/settings/development.py +++ b/note_kfet/settings/development.py @@ -51,4 +51,4 @@ SESSION_COOKIE_AGE = 60 * 60 * 3 # CAS Client settings # Can be modified in secrets.py -CAS_SERVER_URL = "https://note.comby.xyz/cas/" +CAS_SERVER_URL = "http://localhost:8000/cas/" From 762585134ccc0e2fc9a56fd5645568c97fedf902 Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Sat, 7 Mar 2020 17:47:34 +0100 Subject: [PATCH 3/4] fix static files config for development enviromnent --- note_kfet/settings/development.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/note_kfet/settings/development.py b/note_kfet/settings/development.py index e68e9d68..83436339 100644 --- a/note_kfet/settings/development.py +++ b/note_kfet/settings/development.py @@ -52,3 +52,9 @@ SESSION_COOKIE_AGE = 60 * 60 * 3 # CAS Client settings # Can be modified in secrets.py CAS_SERVER_URL = "http://localhost:8000/cas/" + + +STATIC_ROOT = '' # not needed in development settings +STATICFILES_DIRS = [ + os.path.join(BASE_DIR, 'static')] + From 663ee072d499cf89071ec7e1873b4c63a36cd8a4 Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Sat, 7 Mar 2020 17:58:41 +0100 Subject: [PATCH 4/4] always save to png --- apps/member/views.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/member/views.py b/apps/member/views.py index 870079cc..d4bbc592 100644 --- a/apps/member/views.py +++ b/apps/member/views.py @@ -238,17 +238,18 @@ class ProfilePictureUpdateView(LoginRequiredMixin, FormMixin, DetailView): h = form.cleaned_data['height'] # image crop and resize image_file = io.BytesIO(image_field.read()) - ext = image_field.name.split('.')[-1] + ext = image_field.name.split('.')[-1].lower() + #TODO: support GIF format image = Image.open(image_file) image = image.crop((x, y, x+w, y+h)) image_clean = image.resize((settings.PIC_WIDTH, settings.PIC_RATIO*settings.PIC_WIDTH), Image.ANTIALIAS) image_file = io.BytesIO() - image_clean.save(image_file,ext) + image_clean.save(image_file,"PNG") image_field.file = image_file # renaming - filename = "{}_pic.{}".format(self.object.note.pk, ext) + filename = "{}_pic.png".format(self.object.note.pk) image_field.name = filename self.object.note.display_image = image_field self.object.note.save()