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/.python-version b/.python-version new file mode 100644 index 0000000..2e14a95 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.8.6 diff --git a/chat/templates/chat/room_chat.html b/chat/templates/chat/room_chat.html index 62d1937..b39c200 100644 --- a/chat/templates/chat/room_chat.html +++ b/chat/templates/chat/room_chat.html @@ -105,8 +105,6 @@ const { message } = props; console.log("웹소켓으로 전송할 메세지 :", message); - {#this.append_message(message);#} - this.ws.send(JSON.stringify({ type : "chat.message", message : message, diff --git a/ecopschat/settings.py b/ecopschat/settings.py index 18b5a9b..63289ad 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.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 = False +DEBUG = bool(os.environ.setdefault('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' @@ -117,12 +121,6 @@ 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', - # 'ENGINE': 'django.db.backends.postgresql_psycopg2', - # 'NAME': 'ounce_db', - # 'USER': 'postgres', - # 'PASSWORD': 'ecops123', - # 'HOST': 'localhost', - # 'PORT': 5432, } } @@ -159,12 +157,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..ec9a331 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,16 @@ 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