From db1b32e69f0cfac4fa1cf7d5d2bc00faed35df3d Mon Sep 17 00:00:00 2001 From: Gabriel Flores Date: Tue, 21 Nov 2023 19:50:38 -0300 Subject: [PATCH 01/19] remove mysql dependency --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index c2408710..fba629c7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,7 +19,7 @@ django==2.2.20 djangorestframework==3.12.4 idna==2.10; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' ipdb==0.13.9 -mysqlclient==2.1.0 +# mysqlclient==2.1.0 oauthlib==3.2.0; python_version >= '3.6' pycparser==2.21 pyjwt==2.0.1 From 6de011a1055c7273c9f60e459f859e580c9bbc1d Mon Sep 17 00:00:00 2001 From: Gabriel Flores Date: Tue, 21 Nov 2023 19:59:05 -0300 Subject: [PATCH 02/19] Setup Vercel --- edagames/settings/dev.py | 1 + vercel.json | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 vercel.json diff --git a/edagames/settings/dev.py b/edagames/settings/dev.py index c14e3236..0443032d 100644 --- a/edagames/settings/dev.py +++ b/edagames/settings/dev.py @@ -30,6 +30,7 @@ 'localhost', '127.0.0.1', 'django', + '.vercel.app', ] diff --git a/vercel.json b/vercel.json new file mode 100644 index 00000000..a7e7db99 --- /dev/null +++ b/vercel.json @@ -0,0 +1,14 @@ +{ + "builds": [ + { + "src": "edagames/wsgi.py", + "use": "@vercel/python" + } + ], + "routes": [ + { + "src": "/(.*)", + "dest": "edagames/wsgi.py" + } + ] +} \ No newline at end of file From ead1df29ed774abc0fd23abe2f2dbcac61452be2 Mon Sep 17 00:00:00 2001 From: Gabriel Flores Date: Tue, 21 Nov 2023 20:04:52 -0300 Subject: [PATCH 03/19] remove mysql --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index fba629c7..99443875 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,7 +19,7 @@ django==2.2.20 djangorestframework==3.12.4 idna==2.10; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' ipdb==0.13.9 -# mysqlclient==2.1.0 +# # mysqlclient==2.1.0 oauthlib==3.2.0; python_version >= '3.6' pycparser==2.21 pyjwt==2.0.1 From 18fa9a53bf1bd516fde6fbe26fdf6ebf8ed09481 Mon Sep 17 00:00:00 2001 From: Gabriel Flores Date: Tue, 21 Nov 2023 20:11:56 -0300 Subject: [PATCH 04/19] disable pipfile --- Pipfile.lock => Pipfile.lock.not-in-use | 0 Pipfile => Pipfile.not-in-use | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename Pipfile.lock => Pipfile.lock.not-in-use (100%) rename Pipfile => Pipfile.not-in-use (95%) diff --git a/Pipfile.lock b/Pipfile.lock.not-in-use similarity index 100% rename from Pipfile.lock rename to Pipfile.lock.not-in-use diff --git a/Pipfile b/Pipfile.not-in-use similarity index 95% rename from Pipfile rename to Pipfile.not-in-use index 74d03099..58b144e5 100644 --- a/Pipfile +++ b/Pipfile.not-in-use @@ -12,7 +12,7 @@ social-auth-app-django = "==4.0.0" social-auth-core = "==4.1.0" Django = "==2.2.20" PyJWT = "==2.0.1" -mysqlclient = "*" +# mysqlclient = "*" [dev-packages] coverage = "==5.5" From 87ccc99c335a49f4033408e1e3742a03709f57f6 Mon Sep 17 00:00:00 2001 From: Gabriel Flores Date: Tue, 21 Nov 2023 20:26:48 -0300 Subject: [PATCH 05/19] fix get env var --- environment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.py b/environment.py index ba1c609e..bcf3c23c 100644 --- a/environment.py +++ b/environment.py @@ -4,7 +4,7 @@ def get_env_variable(var_name): try: - return os.environ[var_name] + return os.environ.get(var_name) except KeyError: error_msg = "Set the %s environment variable" % var_name raise ImproperlyConfigured(error_msg) From 3fc37ca780dce7aa1fb0c4d06361047103817391 Mon Sep 17 00:00:00 2001 From: Gabriel Flores Date: Wed, 22 Nov 2023 08:25:07 -0300 Subject: [PATCH 06/19] config postgres --- edagames/settings/prod.py | 12 +++--------- requirements.txt | 4 +++- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/edagames/settings/prod.py b/edagames/settings/prod.py index 6c14a404..8dc9ef27 100644 --- a/edagames/settings/prod.py +++ b/edagames/settings/prod.py @@ -123,17 +123,11 @@ def get_secret(db_secret_name): # Database # https://docs.djangoproject.com/en/2.2/ref/settings/#databases -secret_value = json.loads(get_secret(get_env_variable('DB_SECRET_NAME'))) +# secret_value = json.loads(get_secret(get_env_variable('DB_SECRET_NAME'))) +import dj_database_url DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.mysql', - 'NAME': secret_value["dbname"], - 'USER': secret_value["username"], - 'PASSWORD': secret_value["password"], - 'HOST': secret_value["host"], - 'PORT': secret_value["port"] - } + 'default': dj_database_url.config(default=get_env_variable('EDAGAME_POSTGRES_URL')) } # Password validation diff --git a/requirements.txt b/requirements.txt index 99443875..998f24c1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,7 +19,9 @@ django==2.2.20 djangorestframework==3.12.4 idna==2.10; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' ipdb==0.13.9 -# # mysqlclient==2.1.0 +# mysqlclient==2.1.0 +dj-database-url==0.5.0 +psycopg2-binary==2.9.9 oauthlib==3.2.0; python_version >= '3.6' pycparser==2.21 pyjwt==2.0.1 From 6a5063fe86b7501ce3b5705eef28f37fc1fae89c Mon Sep 17 00:00:00 2001 From: Gabriel Flores Date: Wed, 22 Nov 2023 08:29:23 -0300 Subject: [PATCH 07/19] change app noame --- edagames/settings/prod.py | 2 +- edagames/wsgi.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/edagames/settings/prod.py b/edagames/settings/prod.py index 8dc9ef27..b700b103 100644 --- a/edagames/settings/prod.py +++ b/edagames/settings/prod.py @@ -89,7 +89,7 @@ 'django.contrib.auth.backends.ModelBackend', ) -WSGI_APPLICATION = 'edagames.wsgi.application' +WSGI_APPLICATION = 'edagames.wsgi.app' # get secret diff --git a/edagames/wsgi.py b/edagames/wsgi.py index d48226b5..2668d561 100644 --- a/edagames/wsgi.py +++ b/edagames/wsgi.py @@ -13,4 +13,4 @@ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'edagames.settings') -application = get_wsgi_application() +app = get_wsgi_application() From d21acdf5ebd0824168ef318c954ea06c3f86cf89 Mon Sep 17 00:00:00 2001 From: Gabriel Flores Date: Wed, 22 Nov 2023 08:44:40 -0300 Subject: [PATCH 08/19] fix database connection isn't set to UTC --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 998f24c1..455318c6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,7 +21,7 @@ idna==2.10; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3. ipdb==0.13.9 # mysqlclient==2.1.0 dj-database-url==0.5.0 -psycopg2-binary==2.9.9 +psycopg2-binary==2.8.6 oauthlib==3.2.0; python_version >= '3.6' pycparser==2.21 pyjwt==2.0.1 From 402347d956bc3dd65ddee9aef7558b5d8f2496f3 Mon Sep 17 00:00:00 2001 From: Gabriel Flores Date: Wed, 22 Nov 2023 09:02:50 -0300 Subject: [PATCH 09/19] fix ssl conn db --- edagames/settings/prod.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/edagames/settings/prod.py b/edagames/settings/prod.py index b700b103..697df2ab 100644 --- a/edagames/settings/prod.py +++ b/edagames/settings/prod.py @@ -129,6 +129,11 @@ def get_secret(db_secret_name): DATABASES = { 'default': dj_database_url.config(default=get_env_variable('EDAGAME_POSTGRES_URL')) } +DATABASES['default']['OPTIONS'] = { + 'sslmode': 'require' + # 'options': 'endpoint=ep-replace-this-12345679', + } + # Password validation # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators From 6c8b790726af92e8bc976e180c5a3f36a68d8a6a Mon Sep 17 00:00:00 2001 From: Gabriel Flores Date: Thu, 23 Nov 2023 08:28:32 -0300 Subject: [PATCH 10/19] fix db conn --- build_files.sh | 3 +++ edagames/settings/prod.py | 4 ++-- vercel.json | 13 ++++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 build_files.sh diff --git a/build_files.sh b/build_files.sh new file mode 100644 index 00000000..291cb10e --- /dev/null +++ b/build_files.sh @@ -0,0 +1,3 @@ +# build_files.sh +pip install -r requirements.txt +python3.9 manage.py collectstatic diff --git a/edagames/settings/prod.py b/edagames/settings/prod.py index 697df2ab..ad650805 100644 --- a/edagames/settings/prod.py +++ b/edagames/settings/prod.py @@ -130,8 +130,8 @@ def get_secret(db_secret_name): 'default': dj_database_url.config(default=get_env_variable('EDAGAME_POSTGRES_URL')) } DATABASES['default']['OPTIONS'] = { - 'sslmode': 'require' - # 'options': 'endpoint=ep-replace-this-12345679', + 'sslmode': 'require', + 'options': 'endpoint=' + get_env_variable('EDAGAME_POSTGRES_ENDPOINT'), } diff --git a/vercel.json b/vercel.json index a7e7db99..09e6e5a9 100644 --- a/vercel.json +++ b/vercel.json @@ -2,7 +2,18 @@ "builds": [ { "src": "edagames/wsgi.py", - "use": "@vercel/python" + "use": "@vercel/python", + "config": { + "maxLambdaSize": "15mb", + "runtime": "python3.9" + } + }, + { + "src": "build_files.sh", + "use": "@vercel/static-build", + "config": { + "distDir": "staticfiles_build" + } } ], "routes": [ From 8838c6677ca8e27a60101ee01f8697a5e5d9d586 Mon Sep 17 00:00:00 2001 From: Gabriel Flores Date: Thu, 23 Nov 2023 08:37:59 -0300 Subject: [PATCH 11/19] fix static files --- edagames/settings/prod.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/edagames/settings/prod.py b/edagames/settings/prod.py index ad650805..a50f4d91 100644 --- a/edagames/settings/prod.py +++ b/edagames/settings/prod.py @@ -30,7 +30,10 @@ DEBUG = True ALLOWED_HOSTS = [ - '*', + 'localhost', + '127.0.0.1', + 'django', + '.vercel.app', ] @@ -66,6 +69,9 @@ ROOT_URLCONF = 'edagames.urls' +STATIC_URL = '/static/' +STATIC_ROOT = os.path.join(BASE_DIR, 'static') + TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', From 390e157f0ecb929f954f452315d7017443e1f260 Mon Sep 17 00:00:00 2001 From: Gabriel Flores Date: Thu, 23 Nov 2023 08:41:44 -0300 Subject: [PATCH 12/19] fix static again --- edagames/settings/prod.py | 2 +- vercel.json | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/edagames/settings/prod.py b/edagames/settings/prod.py index a50f4d91..dbe7bc78 100644 --- a/edagames/settings/prod.py +++ b/edagames/settings/prod.py @@ -69,7 +69,7 @@ ROOT_URLCONF = 'edagames.urls' -STATIC_URL = '/static/' +STATIC_URL = 'static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') TEMPLATES = [ diff --git a/vercel.json b/vercel.json index 09e6e5a9..fcb0fdf8 100644 --- a/vercel.json +++ b/vercel.json @@ -7,14 +7,15 @@ "maxLambdaSize": "15mb", "runtime": "python3.9" } - }, - { - "src": "build_files.sh", - "use": "@vercel/static-build", - "config": { - "distDir": "staticfiles_build" - } } + //, + // { + // "src": "build_files.sh", + // "use": "@vercel/static-build", + // "config": { + // "distDir": "staticfiles_build" + // } + // } ], "routes": [ { From 85bf2c27167976dad721b2b106c4c1b475c3e763 Mon Sep 17 00:00:00 2001 From: Gabriel Flores Date: Thu, 23 Nov 2023 08:43:31 -0300 Subject: [PATCH 13/19] fix static again2 --- vercel.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/vercel.json b/vercel.json index fcb0fdf8..663aa9f0 100644 --- a/vercel.json +++ b/vercel.json @@ -8,14 +8,6 @@ "runtime": "python3.9" } } - //, - // { - // "src": "build_files.sh", - // "use": "@vercel/static-build", - // "config": { - // "distDir": "staticfiles_build" - // } - // } ], "routes": [ { From 0c9635012baa2ac8ce2de0f0b501b442cca9dd73 Mon Sep 17 00:00:00 2001 From: Gabriel Flores Date: Thu, 23 Nov 2023 08:55:16 -0300 Subject: [PATCH 14/19] fix statics --- edagames/settings/prod.py | 7 +++++-- edagames/urls.py | 2 ++ vercel.json | 7 +++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/edagames/settings/prod.py b/edagames/settings/prod.py index dbe7bc78..bf787ce2 100644 --- a/edagames/settings/prod.py +++ b/edagames/settings/prod.py @@ -69,8 +69,11 @@ ROOT_URLCONF = 'edagames.urls' -STATIC_URL = 'static/' -STATIC_ROOT = os.path.join(BASE_DIR, 'static') +STATICFILES_DIRS = os.path.join(BASE_DIR, 'static'), +STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles_build', 'static') + +# STATIC_URL = 'static/' +# STATIC_ROOT = os.path.join(BASE_DIR, 'static') TEMPLATES = [ { diff --git a/edagames/urls.py b/edagames/urls.py index bb12bbc5..0c855020 100644 --- a/edagames/urls.py +++ b/edagames/urls.py @@ -25,3 +25,5 @@ path('', include('development.urls', namespace='api')), path('', include(('tournaments.urls'), namespace='tournaments')), ] +urlpatterns += static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT) +urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) diff --git a/vercel.json b/vercel.json index 663aa9f0..09e6e5a9 100644 --- a/vercel.json +++ b/vercel.json @@ -7,6 +7,13 @@ "maxLambdaSize": "15mb", "runtime": "python3.9" } + }, + { + "src": "build_files.sh", + "use": "@vercel/static-build", + "config": { + "distDir": "staticfiles_build" + } } ], "routes": [ From ace39146c415e151bc4227901dae4c67c715d9ae Mon Sep 17 00:00:00 2001 From: Gabriel Flores Date: Fri, 24 Nov 2023 07:53:09 -0300 Subject: [PATCH 15/19] fix static --- build_files.sh | 2 +- edagames/settings/prod.py | 4 ++-- vercel.json | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/build_files.sh b/build_files.sh index 291cb10e..4bf2a752 100644 --- a/build_files.sh +++ b/build_files.sh @@ -1,3 +1,3 @@ # build_files.sh pip install -r requirements.txt -python3.9 manage.py collectstatic +python manage.py collectstatic diff --git a/edagames/settings/prod.py b/edagames/settings/prod.py index bf787ce2..1a09aa1a 100644 --- a/edagames/settings/prod.py +++ b/edagames/settings/prod.py @@ -70,9 +70,9 @@ ROOT_URLCONF = 'edagames.urls' STATICFILES_DIRS = os.path.join(BASE_DIR, 'static'), -STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles_build', 'static') +# STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles_build', 'static') -# STATIC_URL = 'static/' +STATIC_URL = '/static/' # STATIC_ROOT = os.path.join(BASE_DIR, 'static') TEMPLATES = [ diff --git a/vercel.json b/vercel.json index 09e6e5a9..f70a110f 100644 --- a/vercel.json +++ b/vercel.json @@ -12,7 +12,7 @@ "src": "build_files.sh", "use": "@vercel/static-build", "config": { - "distDir": "staticfiles_build" + "distDir": "static" } } ], @@ -21,5 +21,10 @@ "src": "/(.*)", "dest": "edagames/wsgi.py" } + ], + "rewrites": [ + {"source": "/static/(.*)", "destination": "/static/$1"}, + {"source": "/media/(.*)", "destination": "/media/$1"}, + {"source": "/(.*)", "destination": "/index.html"} ] } \ No newline at end of file From 8ea120724f44f67658b81a6324b4e82bbbb2a333 Mon Sep 17 00:00:00 2001 From: Gabriel Flores Date: Fri, 24 Nov 2023 08:02:57 -0300 Subject: [PATCH 16/19] test fix --- build_files.sh | 2 +- edagames/settings/prod.py | 14 ++++++++++---- vercel.json | 11 +++++------ 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/build_files.sh b/build_files.sh index 4bf2a752..5207237a 100644 --- a/build_files.sh +++ b/build_files.sh @@ -1,3 +1,3 @@ # build_files.sh pip install -r requirements.txt -python manage.py collectstatic +# python manage.py collectstatic diff --git a/edagames/settings/prod.py b/edagames/settings/prod.py index 1a09aa1a..032b29b7 100644 --- a/edagames/settings/prod.py +++ b/edagames/settings/prod.py @@ -70,15 +70,21 @@ ROOT_URLCONF = 'edagames.urls' STATICFILES_DIRS = os.path.join(BASE_DIR, 'static'), -# STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles_build', 'static') +STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles_build', 'static') -STATIC_URL = '/static/' +STATIC_URL = 'static/' # STATIC_ROOT = os.path.join(BASE_DIR, 'static') +STATICFILES_DIRS = [ + BASE_DIR / "static", + # '/var/www/static/', +] +MEDIA_URL = '/media/' + TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': ['templates'], + 'DIRS': [BASE_DIR / 'templates'], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -198,7 +204,7 @@ def get_secret(db_secret_name): # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.2/howto/static-files/ -STATIC_URL = '/static/' +# STATIC_URL = '/static/' LOGIN_REDIRECT_URL = '/' LOGOUT_REDIRECT_URL = '/login' STATICFILES_DIRS = ['static'] diff --git a/vercel.json b/vercel.json index f70a110f..ce7c9a9a 100644 --- a/vercel.json +++ b/vercel.json @@ -12,19 +12,18 @@ "src": "build_files.sh", "use": "@vercel/static-build", "config": { - "distDir": "static" + "distDir": "staticfiles_build" } } ], "routes": [ + { + "src": "/static/(.*)", + "dest": "/static/$1" + }, { "src": "/(.*)", "dest": "edagames/wsgi.py" } - ], - "rewrites": [ - {"source": "/static/(.*)", "destination": "/static/$1"}, - {"source": "/media/(.*)", "destination": "/media/$1"}, - {"source": "/(.*)", "destination": "/index.html"} ] } \ No newline at end of file From 58f60897892df7eaeccb47386486bde2b65265fb Mon Sep 17 00:00:00 2001 From: Gabriel Flores Date: Fri, 24 Nov 2023 08:11:02 -0300 Subject: [PATCH 17/19] test fix --- build_files.sh | 4 +++- edagames/settings/prod.py | 14 ++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build_files.sh b/build_files.sh index 5207237a..e48ef1fb 100644 --- a/build_files.sh +++ b/build_files.sh @@ -1,3 +1,5 @@ # build_files.sh +echo "BUILD START" pip install -r requirements.txt -# python manage.py collectstatic +python manage.py collectstatic --noinput --clear +echo "BUILD END" \ No newline at end of file diff --git a/edagames/settings/prod.py b/edagames/settings/prod.py index 032b29b7..6454ac85 100644 --- a/edagames/settings/prod.py +++ b/edagames/settings/prod.py @@ -18,8 +18,8 @@ import json # Build paths inside the project like this: os.path.join(BASE_DIR, ...) -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - +# BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ @@ -69,14 +69,14 @@ ROOT_URLCONF = 'edagames.urls' -STATICFILES_DIRS = os.path.join(BASE_DIR, 'static'), -STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles_build', 'static') +# STATICFILES_DIRS = os.path.join(BASE_DIR, 'static'), +# STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles_build', 'static') STATIC_URL = 'static/' # STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATICFILES_DIRS = [ - BASE_DIR / "static", + BASE_DIR, "static", # '/var/www/static/', ] MEDIA_URL = '/media/' @@ -84,7 +84,7 @@ TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [BASE_DIR / 'templates'], + 'DIRS': [BASE_DIR, 'templates'], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -204,10 +204,8 @@ def get_secret(db_secret_name): # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.2/howto/static-files/ -# STATIC_URL = '/static/' LOGIN_REDIRECT_URL = '/' LOGOUT_REDIRECT_URL = '/login' -STATICFILES_DIRS = ['static'] CRISPY_TEMPLATE_PACK = 'bootstrap4' LOGIN_URL = 'login' LOGOUT_URL = 'logout' From 28141c6e916cab916252429b2757ae1e2e33d112 Mon Sep 17 00:00:00 2001 From: Gabriel Flores Date: Fri, 24 Nov 2023 08:13:38 -0300 Subject: [PATCH 18/19] test fix --- build_files.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_files.sh b/build_files.sh index e48ef1fb..dd998d74 100644 --- a/build_files.sh +++ b/build_files.sh @@ -1,5 +1,5 @@ # build_files.sh echo "BUILD START" pip install -r requirements.txt -python manage.py collectstatic --noinput --clear +python3.9 manage.py collectstatic --noinput --clear echo "BUILD END" \ No newline at end of file From 5c75b23fd297229969eb0a23860016d459a33e2b Mon Sep 17 00:00:00 2001 From: Gabriel Flores Date: Fri, 24 Nov 2023 08:16:11 -0300 Subject: [PATCH 19/19] test fix --- edagames/settings/prod.py | 20 ++++++++++++++------ vercel.json | 5 +++-- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/edagames/settings/prod.py b/edagames/settings/prod.py index 6454ac85..c84028ea 100644 --- a/edagames/settings/prod.py +++ b/edagames/settings/prod.py @@ -16,6 +16,7 @@ import base64 from botocore.exceptions import ClientError import json +from pathlib import Path # Build paths inside the project like this: os.path.join(BASE_DIR, ...) # BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -73,13 +74,20 @@ # STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles_build', 'static') STATIC_URL = 'static/' -# STATIC_ROOT = os.path.join(BASE_DIR, 'static') -STATICFILES_DIRS = [ - BASE_DIR, "static", - # '/var/www/static/', -] -MEDIA_URL = '/media/' +# STATICFILES_DIRS = [ +# BASE_DIR / "static", +# ] +# STATIC_ROOT = BASE_DIR / 'static' +# MEDIA_URL = '/media/' + + +STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static'), ] +# Configures the staticfiles directory to serve +# static files from /static/ on our deployment +STATIC_ROOT = os.path.join( + BASE_DIR, + 'staticfiles', 'static') TEMPLATES = [ { diff --git a/vercel.json b/vercel.json index ce7c9a9a..5013f028 100644 --- a/vercel.json +++ b/vercel.json @@ -12,7 +12,7 @@ "src": "build_files.sh", "use": "@vercel/static-build", "config": { - "distDir": "staticfiles_build" + "distDir": "staticfiles" } } ], @@ -25,5 +25,6 @@ "src": "/(.*)", "dest": "edagames/wsgi.py" } - ] + ], + "outputDirectory": "staticfiles" } \ No newline at end of file