From c1a98fcc1367e79384e3c2a3c3a0de8a7c9040c8 Mon Sep 17 00:00:00 2001 From: JK-cs Date: Thu, 23 Feb 2023 06:17:15 +0900 Subject: [PATCH 1/9] heroku settings --- .gitignore | 8 +++++++- ecopschat/settings.py | 26 ++++++++++++++++---------- requirements.txt | 15 ++++++++------- runtime.txt | 2 +- 4 files changed, 32 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 42976a1..ac5755d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,16 @@ *.pyc __pycache__ +*.local_settings*.pot +*.pvc +*.py[cod] db.sqlite3 +.DS_Store /static /media -venv +.Python +venv/ .venv .idea .vscode local_settings.py +postgresql_15.exe \ No newline at end of file diff --git a/ecopschat/settings.py b/ecopschat/settings.py index d62d3eb..cdcffd0 100644 --- a/ecopschat/settings.py +++ b/ecopschat/settings.py @@ -14,6 +14,7 @@ import dj_database_url import django_heroku from environ import Env +import os # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -50,12 +51,13 @@ # See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'django-insecure-ccpa_dgd-*m0a)#nd#u&bhrt&$#i5&u*eu&l4$au9+z-748(&0' +SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', 'django-insecure-ccpa_dgd-*m0a)#nd#u&bhrt&$#i5&u*eu&l4$au9+z-748(&0') + # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = False +DEBUG = bool(os.envorion.get('DJANGO_DEBUG', True)) -ALLOWED_HOSTS = ['127.0.0.1','.herokuapp.com'] +ALLOWED_HOSTS = ['*'] # Application definition @@ -73,6 +75,7 @@ "django_bootstrap5", "chat", "accounts", + 'corsheaders', ] MIDDLEWARE = [ @@ -84,6 +87,7 @@ 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', + 'corsheaders.middleware.CorsMiddleware', ] django_heroku.settings(locals()) ROOT_URLCONF = 'ecopschat.urls' @@ -118,9 +122,9 @@ 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'ecopschat', 'USER': 'name', - 'PASSWORD': '', + 'PASSWORD': '1234', 'HOST': 'localhost', - 'PORT': '', + 'PORT': '5432', } } @@ -157,12 +161,14 @@ USE_TZ = True -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/4.1/howto/static-files/ - -STATIC_URL = 'static/' - # Default primary key field type # https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/4.1/howto/static-files/ + +STATIC_URL = '/static/' +STATIC_ROOT=os.path.join(BASE_DIR, 'staticfiles') \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index bc15522..15047bf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ asgiref==3.6.0 async-timeout==4.0.2 attrs==22.2.0 -autobahn==23.1.1 +autobahn==23.1.2 Automat==22.10.0 beautifulsoup4==4.11.2 certifi==2022.12.7 @@ -11,11 +11,12 @@ channels-redis==4.0.0 charset-normalizer==3.0.1 colorama==0.4.6 constantly==15.1.0 -cryptography==39.0.0 +cryptography==39.0.1 daphne==4.0.0 dj-database-url==1.2.0 -Django==4.1.6 +Django==4.1.7 django-bootstrap5==22.2 +django-cors-headers==3.13.0 django-environ==0.9.0 django-heroku==0.3.1 exceptiongroup==1.1.0 @@ -28,6 +29,7 @@ msgpack==1.0.4 packaging==23.0 pluggy==1.0.0 psycopg2==2.9.5 +psycopg2-binary==2.9.5 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycparser==2.21 @@ -35,18 +37,17 @@ pyOpenSSL==23.0.0 pytest==7.2.1 pytest-asyncio==0.20.3 pytest-django==4.5.2 -pytest-testdox==3.0.1 -redis==4.4.2 +redis==4.5.1 requests==2.28.2 service-identity==21.1.0 six==1.16.0 -soupsieve==2.3.2.post1 +soupsieve==2.4 sqlparse==0.4.3 tomli==2.0.1 Twisted==22.10.0 twisted-iocpsupport==1.0.2 txaio==23.1.1 -typing_extensions==4.4.0 +typing_extensions==4.5.0 tzdata==2022.7 urllib3==1.26.14 whitenoise==6.3.0 diff --git a/runtime.txt b/runtime.txt index 3338e5c..f023023 100644 --- a/runtime.txt +++ b/runtime.txt @@ -1 +1 @@ -python-3.10.4 \ No newline at end of file +python-3.10.7 \ No newline at end of file From f222896d3d079eb585a6c9c7f16d9a1d6412d4ba Mon Sep 17 00:00:00 2001 From: JK-cs Date: Thu, 23 Feb 2023 07:00:36 +0900 Subject: [PATCH 2/9] python 3.8.6 --- .python-version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .python-version diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..2e14a95 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.8.6 From 67d9fcd9ce49dde2b398866266ebbe3e313f68d0 Mon Sep 17 00:00:00 2001 From: JK-cs Date: Thu, 23 Feb 2023 07:09:57 +0900 Subject: [PATCH 3/9] =?UTF-8?q?=EB=AA=B0=EB=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 15047bf..ec9a331 100644 --- a/requirements.txt +++ b/requirements.txt @@ -45,7 +45,6 @@ soupsieve==2.4 sqlparse==0.4.3 tomli==2.0.1 Twisted==22.10.0 -twisted-iocpsupport==1.0.2 txaio==23.1.1 typing_extensions==4.5.0 tzdata==2022.7 From 59dac4c9590e29382c4a20fbf3dd44716bc2f16d Mon Sep 17 00:00:00 2001 From: JK-cs Date: Thu, 23 Feb 2023 07:17:23 +0900 Subject: [PATCH 4/9] environ.get-->setdefault --- ecopschat/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ecopschat/settings.py b/ecopschat/settings.py index cdcffd0..b74748e 100644 --- a/ecopschat/settings.py +++ b/ecopschat/settings.py @@ -55,7 +55,7 @@ # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = bool(os.envorion.get('DJANGO_DEBUG', True)) +DEBUG = bool(os.envorion.setdefault('DJANGO_DEBUG', True)) ALLOWED_HOSTS = ['*'] From 4e49515486edc76f3905764c31559f6e72b22958 Mon Sep 17 00:00:00 2001 From: JK-cs Date: Thu, 23 Feb 2023 07:20:56 +0900 Subject: [PATCH 5/9] environ->env --- ecopschat/settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ecopschat/settings.py b/ecopschat/settings.py index b74748e..e4e72b4 100644 --- a/ecopschat/settings.py +++ b/ecopschat/settings.py @@ -51,11 +51,11 @@ # See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', 'django-insecure-ccpa_dgd-*m0a)#nd#u&bhrt&$#i5&u*eu&l4$au9+z-748(&0') +SECRET_KEY = os.env.get('DJANGO_SECRET_KEY', 'django-insecure-ccpa_dgd-*m0a)#nd#u&bhrt&$#i5&u*eu&l4$au9+z-748(&0') # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = bool(os.envorion.setdefault('DJANGO_DEBUG', True)) +DEBUG = bool(os.env.get('DJANGO_DEBUG', True)) ALLOWED_HOSTS = ['*'] From 7cb9eecf0d68fd24d97a762ced4632e3552d2b76 Mon Sep 17 00:00:00 2001 From: JK-cs Date: Thu, 23 Feb 2023 07:23:21 +0900 Subject: [PATCH 6/9] =?UTF-8?q?os=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ecopschat/settings.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ecopschat/settings.py b/ecopschat/settings.py index e4e72b4..8b9e1bf 100644 --- a/ecopschat/settings.py +++ b/ecopschat/settings.py @@ -14,7 +14,6 @@ import dj_database_url import django_heroku from environ import Env -import os # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -51,11 +50,11 @@ # See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = os.env.get('DJANGO_SECRET_KEY', 'django-insecure-ccpa_dgd-*m0a)#nd#u&bhrt&$#i5&u*eu&l4$au9+z-748(&0') +SECRET_KEY = env.get('DJANGO_SECRET_KEY', 'django-insecure-ccpa_dgd-*m0a)#nd#u&bhrt&$#i5&u*eu&l4$au9+z-748(&0') # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = bool(os.env.get('DJANGO_DEBUG', True)) +DEBUG = bool(env.get('DJANGO_DEBUG', True)) ALLOWED_HOSTS = ['*'] From d8ad05dfba181f16cb3a6b840002d3af31f7312d Mon Sep 17 00:00:00 2001 From: JK-cs Date: Thu, 23 Feb 2023 07:29:10 +0900 Subject: [PATCH 7/9] setdefault --- ecopschat/settings.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ecopschat/settings.py b/ecopschat/settings.py index 8b9e1bf..e541d27 100644 --- a/ecopschat/settings.py +++ b/ecopschat/settings.py @@ -14,6 +14,7 @@ import dj_database_url import django_heroku from environ import Env +import os # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -50,11 +51,11 @@ # See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = env.get('DJANGO_SECRET_KEY', 'django-insecure-ccpa_dgd-*m0a)#nd#u&bhrt&$#i5&u*eu&l4$au9+z-748(&0') +SECRET_KEY = os.environ.setdefault('DJANGO_SECRET_KEY', 'django-insecure-ccpa_dgd-*m0a)#nd#u&bhrt&$#i5&u*eu&l4$au9+z-748(&0') # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = bool(env.get('DJANGO_DEBUG', True)) +DEBUG = bool(os.environ.setdefault('DJANGO_DEBUG', True)) ALLOWED_HOSTS = ['*'] From 7ddd51e78aa93ccaea77755214d75ebc8fa815ea Mon Sep 17 00:00:00 2001 From: JK-cs Date: Thu, 23 Feb 2023 07:32:22 +0900 Subject: [PATCH 8/9] =?UTF-8?q?True=20string=EC=9C=BC=EB=A1=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ecopschat/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ecopschat/settings.py b/ecopschat/settings.py index e541d27..582d03c 100644 --- a/ecopschat/settings.py +++ b/ecopschat/settings.py @@ -55,7 +55,7 @@ # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = bool(os.environ.setdefault('DJANGO_DEBUG', True)) +DEBUG = bool(os.environ.setdefault('DJANGO_DEBUG', "True")) ALLOWED_HOSTS = ['*'] From 2c150fdbf5d91bcd2351029baa38a4a044962485 Mon Sep 17 00:00:00 2001 From: JK-cs Date: Thu, 23 Feb 2023 19:46:59 +0900 Subject: [PATCH 9/9] =?UTF-8?q?=EC=B6=A9=EB=8F=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ecopschat/settings.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ecopschat/settings.py b/ecopschat/settings.py index 582d03c..63289ad 100644 --- a/ecopschat/settings.py +++ b/ecopschat/settings.py @@ -119,12 +119,8 @@ DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'ecopschat', - 'USER': 'name', - 'PASSWORD': '1234', - 'HOST': 'localhost', - 'PORT': '5432', + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', } }