diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 8ad3a4fa..58b1934f 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,6 +1,9 @@ --- name: Bug report about: Report a bug to help us improve Jandig +title: '' +labels: bug +assignees: '' --- @@ -17,11 +20,12 @@ Steps to reproduce the behavior: **Expected behavior** A clear and concise description of what was expected to happen. -**Screenshots** -If applicable, add screenshots to help explain your problem. +**Screen captures** +If applicable, add screenshots or screencasts to help explain your problem. -**Please, tell us which device/browser is used when finding the bug):** - - OS: [ex.: iOS], Browser [ex.: chrome], Version [ex.: 22] +**Please, tell us which device/browser (with versions) are used when finding the bug:** + - OS: [ex.: iOS 12] + - Browser: [ex.: Chrome 91.0.4472.114] **Additional Information** -Add other information about the problem here, if necessary. \ No newline at end of file +Add other information about the problem here, if necessary. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..34b5a2e4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,22 @@ +--- +name: Feature Request +about: I have a suggestion to Jandig (and may want to implement it)! +title: '' +labels: feature, enhancement +assignees: '' + +--- + +## Feature Request + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I have an issue when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. Add any considered drawbacks. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Is there anything else you can add about the proposal? Maybe a screenshot or design? diff --git a/.github/ISSUE_TEMPLATE/refactoring.md b/.github/ISSUE_TEMPLATE/refactoring.md new file mode 100644 index 00000000..51681b1c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/refactoring.md @@ -0,0 +1,27 @@ +--- +name: Refactoring proposal +about: Suggest a way to improve our source code +title: '' +labels: code +assignees: '' + +--- + +## Refactoring Proposal + +**Describe the design issue(s) you have identified in the code** +Clear and concise description of code smells, technical debits or general code improvements. + +**Which source files are affected to this issue(s)?** +Clear and concise list of relative paths to files that are affected to this issue. + +1. Relative path to file 1; +2. Relative path to file 2; +3. Etc. + +**Describe refactoring alternatives to redesign the code** +Clear and concise list with descriptions of how to refactor the code. Maybe [potential solutions from the refactoring catalog](https://refactoring.com/catalog/). + +1. Refactoring 1; +2. Refactoring 2; +3. Etc. diff --git a/.gitignore b/.gitignore index f4bc373d..5e7d1ba2 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,5 @@ docker/media/ # translations *.mo *.po~ + +src/.envs/.env diff --git a/README.md b/README.md index 53817028..24971710 100644 --- a/README.md +++ b/README.md @@ -11,25 +11,25 @@ Jandig ARte uses image pattern detection to detect [augmented reality markers](h Jandig ARte is a Progressive Web App, which means you can open in every device with a browser and a camera. Also you can add Jandig ARte to your homescreen and it will run like a native app on your device. ### People -We are a small team based in Brazil :D talk to us on [Telegram](https://t.me/joinchat/HES_ShA6TMPP-aiHxH7thQ). There's a list of the main contributors of Jandig development: -* @vjpixel - [GitHub](https://github.com/vjpixel), [Twitter](https://twitter.com/vjpixel), [Instagram](https://instagram.com/vjpixel), -* @pablodiegoss - [GitHub](https://github.com/pablodiegoss), [Twitter](https://twitter.com/pablodiegosds) -* @rodrigocam - [GitHub](https://github.com/rodrigocam), [Twitter](https://twitter.com/sayadiguin) -* @hvalois - [GitHub](https://github.com/hvalois), [Twitter](https://twitter.com/hebertvalois), [Instagram](https://www.instagram.com/hebertvalois/) -* @hockpond - [GitHub](https://github.com/hockpond) -* @anacforcelli - [GitHub](https://github.com/anacforcelli) -* @luccaepp - [GitHub](https://github.com/luccaepp), [Twitter](https://twitter.com/luccaepp) -* @Heloisecs - [GitHub](https://github.com/Heloisecs), [Twitter](https://twitter.com/heloisecullen) -* @LeoSGomes - [GitHub](https://github.com/LeoSilvaGomes), [Twitter](https://twitter.com/LeoSGomes), [Instagram](https://www.instagram.com/leonardodasilvagomes/) -* @kisobral - [GitHub](https://github.com/KiSobral), [Instagram](https://www.instagram.com/hugsob/) -* @rhuancpq - [GitHub](https://github.com/Rhuancpq), [Twitter](https://twitter.com/rhuancpq) -* @thiagohersan - [GitHub](https://github.com/thiagohersan) -* @manuengsf - [Github](https://github.com/manuengsf) -* @darmsDD - [Github](https://github.com/darmsDD) -* @MatheusBlanco - [Github](https://github.com/MatheusBlanco) -* @devsalula - [Github](https://github.com/devsalula) -* @shayanealcantara [Github](https://github.com/shayanealcantara) -* @victoralvesgomide - [Github](https://github.com/victoralvesgomide) +We are a small team based in Brazil :D talk to us on [Telegram](https://t.me/joinchat/HES_ShA6TMPP-aiHxH7thQ). Here's a list of some of the contributors for the development: +* [@pablodiegoss](https://github.com/pablodiegoss) ([Twitter](https://twitter.com/pablodiegosds)) +* [@hvalois](https://github.com/hvalois) ([Twitter](https://twitter.com/hebertvalois), [Instagram](https://www.instagram.com/hebertvalois/)) +* [@rodrigocam](https://github.com/rodrigocam) ([Twitter](https://twitter.com/sayadiguin)) +* [@vjpixel](https://github.com/vjpixel) ([Twitter](https://twitter.com/vjpixel), [Instagram](https://instagram.com/vjpixel)) +* [@anacforcelli](https://github.com/anacforcelli) +* [@MatheusBlanco](https://github.com/MatheusBlanco) +* [@hockpond](https://github.com/hockpond) +* [@devsalula](https://github.com/devsalula) +* [@shayanealcantara](https://github.com/shayanealcantara) +* [@victoralvesgomide](https://github.com/victoralvesgomide) +* [@manuengsf](https://github.com/manuengsf) +* [@darmsDD](https://github.com/darmsDD) +* [@luccaepp](https://github.com/luccaepp) ([Twitter](https://twitter.com/luccaepp)) +* [@Heloisecs](https://github.com/Heloisecs) ([Twitter](https://twitter.com/heloisecullen)) +* [@rhuancpq](https://github.com/Rhuancpq) ([Twitter](https://twitter.com/rhuancpq)) +* [@LeoSGomes](https://github.com/LeoSilvaGomes) ([Twitter](https://twitter.com/LeoSGomes), [Instagram](https://www.instagram.com/leonardodasilvagomes/)) +* [@kisobral](https://github.com/KiSobral) ([Instagram](https://www.instagram.com/hugsob/)) +* [@thiagohersan](https://github.com/thiagohersan) ### Collab We are looking for artists (both illustrators and animators) to create great content and help us testing the platform, people to translate our website from Portuguese to English (and vice versa), and developers to help us with the platform, please contact us via the Telegram channel or an issue on GitHub! diff --git a/docker/Dockerfile b/docker/Dockerfile index 74c6f56d..b59f6441 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -6,6 +6,7 @@ COPY docs/ /ARte/docs/ COPY ./src/ARte /ARte/src/ARte/ COPY ./locale/ /ARte/locale/ COPY ./tasks.py /ARte/tasks.py +COPY ./run.sh /ARte/run.sh COPY ./etc/ /ARte/etc/ RUN find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index a68ad25b..a5f4e9cb 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -14,16 +14,15 @@ services: - ../locale/:/ARte/locale/ - ./media/:/ARte/src/ARte/users/media/ env_file: - - ../src/.envs/.django - - ../src/.envs/.postgres + - ../src/.envs/.env depends_on: - postgres - command: inv db -p i18n --compile docs collect run -p + command: ./run.sh postgres: - image: postgres:11.6 + image: postgres:12.6 env_file: - - ../src/.envs/.postgres + - ../src/.envs/.env command: postgres -c max_connections=10000 ports: - "5432:5432" diff --git a/docs/jandig_prototype.fig b/docs/jandig_prototype.fig new file mode 100644 index 00000000..f1086a94 Binary files /dev/null and b/docs/jandig_prototype.fig differ diff --git a/docs/prototype_png_files/Change Idiom.png b/docs/prototype_png_files/Change Idiom.png new file mode 100644 index 00000000..022262c9 Binary files /dev/null and b/docs/prototype_png_files/Change Idiom.png differ diff --git a/docs/prototype_png_files/Collections.png b/docs/prototype_png_files/Collections.png new file mode 100644 index 00000000..4b8f4846 Binary files /dev/null and b/docs/prototype_png_files/Collections.png differ diff --git a/docs/prototype_png_files/Confirm Delete.png b/docs/prototype_png_files/Confirm Delete.png new file mode 100644 index 00000000..f2b5f394 Binary files /dev/null and b/docs/prototype_png_files/Confirm Delete.png differ diff --git a/docs/prototype_png_files/Create artwork.png b/docs/prototype_png_files/Create artwork.png new file mode 100644 index 00000000..d56530e3 Binary files /dev/null and b/docs/prototype_png_files/Create artwork.png differ diff --git a/docs/prototype_png_files/Create exhibition.png b/docs/prototype_png_files/Create exhibition.png new file mode 100644 index 00000000..e46e6008 Binary files /dev/null and b/docs/prototype_png_files/Create exhibition.png differ diff --git a/docs/prototype_png_files/Delete Account.png b/docs/prototype_png_files/Delete Account.png new file mode 100644 index 00000000..d421c850 Binary files /dev/null and b/docs/prototype_png_files/Delete Account.png differ diff --git a/docs/prototype_png_files/Edit Profile.png b/docs/prototype_png_files/Edit Profile.png new file mode 100644 index 00000000..77d70278 Binary files /dev/null and b/docs/prototype_png_files/Edit Profile.png differ diff --git a/docs/prototype_png_files/Help.png b/docs/prototype_png_files/Help.png new file mode 100644 index 00000000..1af42645 Binary files /dev/null and b/docs/prototype_png_files/Help.png differ diff --git a/docs/prototype_png_files/Homepage.png b/docs/prototype_png_files/Homepage.png new file mode 100644 index 00000000..436b9177 Binary files /dev/null and b/docs/prototype_png_files/Homepage.png differ diff --git a/docs/prototype_png_files/Login.png b/docs/prototype_png_files/Login.png new file mode 100644 index 00000000..edafe693 Binary files /dev/null and b/docs/prototype_png_files/Login.png differ diff --git a/docs/prototype_png_files/Modal Artwork.png b/docs/prototype_png_files/Modal Artwork.png new file mode 100644 index 00000000..3fc508d2 Binary files /dev/null and b/docs/prototype_png_files/Modal Artwork.png differ diff --git a/docs/prototype_png_files/Modal Marker.png b/docs/prototype_png_files/Modal Marker.png new file mode 100644 index 00000000..a456d486 Binary files /dev/null and b/docs/prototype_png_files/Modal Marker.png differ diff --git a/docs/prototype_png_files/Modal Objects.png b/docs/prototype_png_files/Modal Objects.png new file mode 100644 index 00000000..cc7c452f Binary files /dev/null and b/docs/prototype_png_files/Modal Objects.png differ diff --git a/docs/prototype_png_files/My stuff.png b/docs/prototype_png_files/My stuff.png new file mode 100644 index 00000000..58bafa78 Binary files /dev/null and b/docs/prototype_png_files/My stuff.png differ diff --git a/docs/prototype_png_files/Profile.png b/docs/prototype_png_files/Profile.png new file mode 100644 index 00000000..3b169133 Binary files /dev/null and b/docs/prototype_png_files/Profile.png differ diff --git a/docs/prototype_png_files/Register.png b/docs/prototype_png_files/Register.png new file mode 100644 index 00000000..2d61ea9d Binary files /dev/null and b/docs/prototype_png_files/Register.png differ diff --git a/docs/prototype_png_files/Select artwork exhibition.png b/docs/prototype_png_files/Select artwork exhibition.png new file mode 100644 index 00000000..f851b163 Binary files /dev/null and b/docs/prototype_png_files/Select artwork exhibition.png differ diff --git a/docs/prototype_png_files/Select object artwork.png b/docs/prototype_png_files/Select object artwork.png new file mode 100644 index 00000000..afab8291 Binary files /dev/null and b/docs/prototype_png_files/Select object artwork.png differ diff --git a/docs/prototype_png_files/Unified Upload Marker.png b/docs/prototype_png_files/Unified Upload Marker.png new file mode 100644 index 00000000..68c4db97 Binary files /dev/null and b/docs/prototype_png_files/Unified Upload Marker.png differ diff --git a/docs/prototype_png_files/Unified Upload Object.png b/docs/prototype_png_files/Unified Upload Object.png new file mode 100644 index 00000000..18f5c6c6 Binary files /dev/null and b/docs/prototype_png_files/Unified Upload Object.png differ diff --git a/docs/prototype_png_files/Unified create artwork (1).png b/docs/prototype_png_files/Unified create artwork (1).png new file mode 100644 index 00000000..c6f00d49 Binary files /dev/null and b/docs/prototype_png_files/Unified create artwork (1).png differ diff --git a/docs/prototype_png_files/Unified create artwork.png b/docs/prototype_png_files/Unified create artwork.png new file mode 100644 index 00000000..81c555f3 Binary files /dev/null and b/docs/prototype_png_files/Unified create artwork.png differ diff --git a/docs/prototype_png_files/Unified create exhibition.png b/docs/prototype_png_files/Unified create exhibition.png new file mode 100644 index 00000000..8ea7d22a Binary files /dev/null and b/docs/prototype_png_files/Unified create exhibition.png differ diff --git a/docs/prototype_png_files/Upload Marker.png b/docs/prototype_png_files/Upload Marker.png new file mode 100644 index 00000000..b8f8e29e Binary files /dev/null and b/docs/prototype_png_files/Upload Marker.png differ diff --git a/docs/prototype_png_files/Upload Object.png b/docs/prototype_png_files/Upload Object.png new file mode 100644 index 00000000..6b14636c Binary files /dev/null and b/docs/prototype_png_files/Upload Object.png differ diff --git a/docs/prototype_png_files/search exhibition.png b/docs/prototype_png_files/search exhibition.png new file mode 100644 index 00000000..b37ad32b Binary files /dev/null and b/docs/prototype_png_files/search exhibition.png differ diff --git a/locale/pt_BR/LC_MESSAGES/django.po b/locale/pt_BR/LC_MESSAGES/django.po index f09f730d..b866b9f2 100644 --- a/locale/pt_BR/LC_MESSAGES/django.po +++ b/locale/pt_BR/LC_MESSAGES/django.po @@ -136,6 +136,10 @@ msgstr "Título da Exposição" msgid "Exhibit URL" msgstr "URL da exposição" +#: src/ARte/users/forms.py:251 +msgid "Complete with your Exhibit URL here" +msgstr "Complete sua URL de exibição aqui" + #: src/ARte/core/jinja2/core/base.jinja2:44 #, fuzzy msgid "Please override the \"content\" block of your template!" @@ -333,6 +337,10 @@ msgstr "" msgid "Next" msgstr "Próximo" +#: src/ARte/users/jinja2/users/exhibit-create.jinja2:43 +msgid "Your exhibit URL will look like this" +msgstr "Sua URL de exibição vai se parecer com isso." + #: src/ARte/users/jinja2/users/artwork-create.jinja2:57 msgid "Select Object (2/3)" msgstr "Selecione Objeto (2/3)" @@ -349,6 +357,22 @@ msgstr "Publicar obra" msgid "Create Jandig Exhibition" msgstr "Criar Exposição Jandig" +#: src/ARte/users/jinja2/users/artwork-edit.jinja2:11 +msgid "Edit Jandig Artwork" +msgstr "Editar Obra Jandig" + +#: src/ARte/users/jinja2/users/artwork-edit.jinja2:75 +msgid "Edit Artwork" +msgstr "Editar Obra" + +#: src/ARte/users/jinja2/users/exhibit-edit.jinja2:12 +msgid "Edit Jandig Exhibition" +msgstr "Editar Exposição Jandig" + +#: src/ARte/users/jinja2/users/exhibit-edit.jinja2:49 +msgid "Edit Exhibit" +msgstr "Editar Exposição" + #: src/ARte/users/jinja2/users/exhibit-create.jinja2:13 msgid "Select Artworks" msgstr "Escolher Obras" @@ -369,6 +393,10 @@ msgstr "Informações da Exposição (2/2)" msgid "Publish Exhibit" msgstr "Publicar Exposição" +#: src/ARte/users/jinja2/users/exhibit-create.jinja2:82 +msgid "Urls can't contain spaces or special characters (i.e: .:, /)" +msgstr "Urls não podem conter espaços ou caracteres especiais (i.e: .:, /)" + #: src/ARte/users/jinja2/users/invalid-recovering-email.jinja2:14 msgid "There is no user with this e-mail/username." msgstr "Não há usuário com esse e-mail/nome." @@ -630,6 +658,10 @@ msgstr "Curador Jandig" msgid "No Exhibitions yet." msgstr "Sem Exposições ainda." +#: src/ARte/users/jinja2/users/edit-object.jinja2:31 +msgid "Scale should be adjusted relative to Marker size on the screen. A scale of 2 will render an Object twice the size of the Marker." +msgstr "A escala deve ser ajustada relativa ao tamanho do Marcador na tela. Uma escala de 2 irá renderizar um Objeto duas vezes o tamanho do Marcador." + #~ msgid " exhibits" #~ msgstr " exposições" diff --git a/locustfile.py b/locustfile.py index 71cc28de..b9ea8519 100644 --- a/locustfile.py +++ b/locustfile.py @@ -1,4 +1,4 @@ -from locust import HttpLocust, TaskSet, between +from locust import HttpLocust, Set, between def index(l): l.client.get("/") @@ -9,9 +9,9 @@ def load_gifs(l): def exhibit(l): l.client.get("/longavida/") -class UserBehavior(TaskSet): - tasks = {exhibit:1} +class UserBehavior(Set): + s = {exhibit:1} class WebsiteUser(HttpLocust): - task_set = UserBehavior + _set = UserBehavior wait_time = between(3,5) \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100755 index 00000000..3a953847 --- /dev/null +++ b/run.sh @@ -0,0 +1,3 @@ +#!/bin/bash +pip list +inv i18n --compile docs run -p -g diff --git a/src/.envs/.dev_deploy b/src/.envs/.dev_deploy deleted file mode 100644 index 025bf24c..00000000 --- a/src/.envs/.dev_deploy +++ /dev/null @@ -1,15 +0,0 @@ -# PostgreSQL -# ---------- -POSTGRES_HOST=dev_postgres -POSTGRES_PORT=5432 -POSTGRES_DB=dev_db -POSTGRES_USER=dev_user -POSTGRES_PASSWORD=dev_password - -# Django -# ---------- -DJANGO_DEBUG=False -DJANGO_SETTINGS_MODULE=config.settings -DJANGO_ADMIN_URL=admin/ -DEV_DB=False -DEBUG_TOOLBAR=False \ No newline at end of file diff --git a/src/.envs/.django b/src/.envs/.django deleted file mode 100644 index 99c123f5..00000000 --- a/src/.envs/.django +++ /dev/null @@ -1,6 +0,0 @@ -DJANGO_DEBUG=True -DJANGO_SETTINGS_MODULE=config.settings -DJANGO_ADMIN_URL=admin/ -DEV_DB=False -DEV_STATIC=False -DEBUG_TOOLBAR=True \ No newline at end of file diff --git a/src/.envs/.example b/src/.envs/.example new file mode 100644 index 00000000..1aef234d --- /dev/null +++ b/src/.envs/.example @@ -0,0 +1,29 @@ +# Use this file to create a .env with filled variables +# Django Variables +DJANGO_DEBUG=True +DJANGO_SETTINGS_MODULE=config.settings +DJANGO_ADMIN_URL=admin/ +DEV_DB=False +DEV_STATIC=False +DEBUG_TOOLBAR=True +DJANGO_SECRET_KEY= + +## Amazon AWS Variables +AWS_ACCESS_KEY_ID= +AWS_SECRET_ACCESS_KEY= +AWS_STORAGE_BUCKET_NAME= +AWS_S3_REGION_NAME= +USE_S3= + +## Postgres variables +POSTGRES_HOST=postgres +POSTGRES_PORT=5432 +POSTGRES_DB=goldpenny +POSTGRES_USER=goldpenny +POSTGRES_PASSWORD=goldpenny123 + +# Email server variables +SMTP_SERVER=smtp.gmail.com +SMTP_PORT=587 +JANDIG_EMAIL=local_jandig@memelab.com.br +JANDIG_EMAIL_PASSWORD=local_password \ No newline at end of file diff --git a/src/.envs/.postgres b/src/.envs/.postgres deleted file mode 100644 index 33e4bf16..00000000 --- a/src/.envs/.postgres +++ /dev/null @@ -1,5 +0,0 @@ -POSTGRES_HOST=postgres -POSTGRES_PORT=5432 -POSTGRES_DB=goldpenny -POSTGRES_USER=goldpenny -POSTGRES_PASSWORD=goldpenny123 \ No newline at end of file diff --git a/src/.envs/.prod_deploy b/src/.envs/.prod_deploy deleted file mode 100644 index dfc4ba02..00000000 --- a/src/.envs/.prod_deploy +++ /dev/null @@ -1,15 +0,0 @@ -# PostgreSQL -# ---------- -POSTGRES_HOST=prod_postgres -POSTGRES_PORT=5432 -POSTGRES_DB=prod_postgres -POSTGRES_USER=prod_user -POSTGRES_PASSWORD=prod_pass - -# Django -# ---------- -DJANGO_DEBUG=False -DJANGO_SETTINGS_MODULE=config.settings -DJANGO_ADMIN_URL=admin/ -DEV_DB=False -DEBUG_TOOLBAR=False \ No newline at end of file diff --git a/src/.envs/.staging_deploy b/src/.envs/.staging_deploy deleted file mode 100644 index 80e52b11..00000000 --- a/src/.envs/.staging_deploy +++ /dev/null @@ -1,15 +0,0 @@ -# PostgreSQL -# ---------- -POSTGRES_HOST=staging_postgres -POSTGRES_PORT=5432 -POSTGRES_DB=staging_db -POSTGRES_USER=staging_user -POSTGRES_PASSWORD=staging_pass - -# Django -# ---------- -DJANGO_DEBUG=False -DJANGO_SETTINGS_MODULE=config.settings -DJANGO_ADMIN_URL=admin/ -DEV_DB=False -DEBUG_TOOLBAR=False \ No newline at end of file diff --git a/src/ARte/config/settings.py b/src/ARte/config/settings.py index e09ef1dc..d69e88a8 100644 --- a/src/ARte/config/settings.py +++ b/src/ARte/config/settings.py @@ -3,6 +3,7 @@ from .wait_db import start_services from django.utils.translation import ugettext_lazy as _ +from socket import gethostbyname, gethostname ROOT_DIR = environ.Path(__file__) - 2 # (ARte/config/settings.py - 2 = ARte/) APPS_DIR = ROOT_DIR.path('ARte') @@ -23,10 +24,35 @@ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = env('DJANGO_SECRET_KEY', default='gw)48fp(ct67v4+0_tpxl=$vw=-x&y9(&0n6!n4mpw5m!4gaor') -ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=['*']) - +ALLOWED_HOSTS = [ + "localhost", + "0.0.0.0", + "127.0.0.1", + gethostname(), + gethostbyname(gethostname()), +] +CUSTOM_ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=['*']) +ALLOWED_HOSTS += CUSTOM_ALLOWED_HOSTS +print(f"ALLOWED_HOSTS:{ALLOWED_HOSTS}") # Application definition +import sentry_sdk +from sentry_sdk.integrations.django import DjangoIntegration + +sentry_sdk.init( + dsn="https://081a2c3476b24a9f9a51d74bde539b62@o968990.ingest.sentry.io/5920229", + integrations=[DjangoIntegration()], + + # Set traces_sample_rate to 1.0 to capture 100% + # of transactions for performance monitoring. + # We recommend adjusting this value in production. + traces_sample_rate=1.0, + + # If you wish to associate users to errors (assuming you are using + # django.contrib.auth) you may enable sending PII data. + send_default_pii=True +) + INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', @@ -39,6 +65,7 @@ 'users', 'core', 'docs', + #'django_extensions', ] MIDDLEWARE = [ @@ -160,13 +187,34 @@ def debug(request): # https://docs.djangoproject.com/en/2.1/howto/static-files/ COLLECT_DIR = os.path.dirname(os.path.dirname(BASE_DIR)) - -STATIC_URL = '/static/' -STATIC_ROOT = os.path.join(COLLECT_DIR, 'collect') +USE_S3 = os.getenv("USE_S3", "False").lower() == "true" STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'core', 'static'), os.path.join(BASE_DIR, 'users', 'static') ] +if USE_S3: + # AWS credentials + AWS_S3_OBJECT_PARAMETERS = { + "CacheControl": "max-age=86400", + } + AWS_ACCESS_KEY_ID = os.getenv("AWS_ACCESS_KEY_ID", "") + AWS_SECRET_ACCESS_KEY = os.getenv("AWS_SECRET_ACCESS_KEY", "") + AWS_STORAGE_BUCKET_NAME = os.getenv("AWS_STORAGE_BUCKET_NAME", "") + AWS_S3_REGION_NAME = os.getenv("AWS_S3_REGION_NAME", "us-east-2") + AWS_S3_CUSTOM_DOMAIN = f"{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com" + AWS_DEFAULT_ACL = os.getenv("AWS_DEFAULT_ACL", None) + AWS_STATIC_LOCATION = os.getenv("AWS_STATIC_LOCATION", "static") + + # Static configuration + STATIC_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}/{AWS_STATIC_LOCATION}/" + STATICFILES_STORAGE = "config.storage_backends.StaticStorage" + + AWS_PUBLIC_MEDIA_LOCATION = "media/public" + DEFAULT_FILE_STORAGE = "config.storage_backends.PublicMediaStorage" +else: + STATIC_URL = '/static/' + STATIC_ROOT = os.path.join(COLLECT_DIR, 'collect') + MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'users', 'media') diff --git a/src/ARte/config/storage_backends.py b/src/ARte/config/storage_backends.py new file mode 100644 index 00000000..48105632 --- /dev/null +++ b/src/ARte/config/storage_backends.py @@ -0,0 +1,11 @@ +from django.conf import settings +from storages.backends.s3boto3 import S3Boto3Storage + + +class StaticStorage(S3Boto3Storage): + location = settings.AWS_STATIC_LOCATION + + +class PublicMediaStorage(S3Boto3Storage): + location = settings.AWS_PUBLIC_MEDIA_LOCATION + file_overwrite = False diff --git a/src/ARte/config/urls.py b/src/ARte/config/urls.py index 1d15a6dc..537d4e3c 100644 --- a/src/ARte/config/urls.py +++ b/src/ARte/config/urls.py @@ -3,9 +3,10 @@ from django.contrib import admin from django.urls import path, include import debug_toolbar +import os urlpatterns = [ - path('admin/', admin.site.urls), + path(os.getenv('DJANGO_ADMIN_URL', 'admin/'), admin.site.urls), path('', include('core.urls')), path('', include('core.routes')), path('users/', include('users.urls')), diff --git a/src/ARte/core/admin.py b/src/ARte/core/admin.py index 84118d22..54a96543 100644 --- a/src/ARte/core/admin.py +++ b/src/ARte/core/admin.py @@ -1,4 +1,7 @@ from django.contrib import admin -from core.models import Exhibit +from core.models import Exhibit, Artwork, Object, Marker -admin.site.register(Exhibit) \ No newline at end of file +admin.site.register(Exhibit) +admin.site.register(Object) +admin.site.register(Marker) +admin.site.register(Artwork) \ No newline at end of file diff --git a/src/ARte/core/jinja2/core/arviewer.jinja2 b/src/ARte/core/jinja2/core/arviewer.jinja2 index 58187c8a..3b7f3197 100644 --- a/src/ARte/core/jinja2/core/arviewer.jinja2 +++ b/src/ARte/core/jinja2/core/arviewer.jinja2 @@ -11,7 +11,7 @@ gtag('config', 'UA-37240876-2'); - +