update settings

master
Tait Hoyem 2 years ago
parent ff57e6b883
commit 1ce91b1871

@ -1,7 +1,7 @@
"""
Django settings for lamegames project.
Generated by 'django-admin startproject' using Django 3.0.8.
Generated by "django-admin startproject" using Django 3.0.8.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
@ -20,88 +20,94 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'o=uifzcv032$(r3%v_(uusy*r#kyuvpwk21d0z*3*ck$^4x%4^'
SECRET_KEY = "o=uifzcv032$(r3%v_(uusy*r#kyuvpwk21d0z*3*ck$^4x%4^"
# SECURITY WARNING: don't run with debug turned on in production!
# SECURITY WARNING: don"t run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
ALLOWED_HOSTS = ["*"]
# Application definition
INSTALLED_APPS = [
# NOTE: keep on top to promote app precedence
'skel',
'common',
'channels',
'chat',
'games',
'chess',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
"skel",
"common",
"channels",
"chat",
"chess",
"minesweeper",
"rps",
"games",
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
]
VISIBLE_GAME_LINKS = [
{
"urls": "minesweeper.urls",
"url": "minesweeper",
"name": "Minesweeper (Single-Player)",
},
{
"urls": "rps.urls",
"url": "rps",
"name": "Rock, Paper, Scissors",
},
{
"urls": "chat.urls",
"url": "chat",
"name": "Chat",
},
{
"urls": "chess.urls",
"url": "chess",
"name": "Chess",
},
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]
ROOT_URLCONF = 'lamegames.urls'
ROOT_URLCONF = "lamegames.urls"
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
BASE_DIR + '/templates/'
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [
BASE_DIR + "/templates/"
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
},
]
#WSGI_APPLICATION = 'lamegames.wsgi.application'
ASGI_APPLICATION = 'lamegames.routing.application'
#WSGI_APPLICATION = "lamegames.wsgi.application"
ASGI_APPLICATION = "lamegames.routing.application"
CHANNEL_LAYERS = {
'default': {
'BACKEND': 'channels_redis.core.RedisChannelLayer',
'CONFIG': {
"hosts": [('127.0.0.1', 6379)],
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [("127.0.0.1", 6379)],
},
},
}
@ -110,9 +116,9 @@ CHANNEL_LAYERS = {
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
}
}
@ -122,28 +128,28 @@ DATABASES = {
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
},
]
# Default auto field
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = "en-us"
TIME_ZONE = 'UTC'
TIME_ZONE = "UTC"
USE_I18N = True
@ -155,17 +161,17 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = './static_gen'
STATIC_URL = "/static/"
STATIC_ROOT = "./static_gen"
# AUTH SETTINGS
LOGIN_REDIRECT_URL = 'index'
LOGOUT_REDIRECT_URL = 'index'
LOGIN_REDIRECT_URL = "index"
LOGOUT_REDIRECT_URL = "index"
# EMAIL SETTINGS
EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
EMAIL_FILE_PATH = os.path.join(BASE_DIR, 'sent_emails')
EMAIL_BACKEND = "django.core.mail.backends.filebased.EmailBackend"
EMAIL_FILE_PATH = os.path.join(BASE_DIR, "sent_emails")
# CUSTOM USER
AUTH_USER_MODEL = 'common.LameUser'
AUTH_USER_MODEL = "common.LameUser"

@ -15,22 +15,24 @@ Including another URLconf
"""
from django.contrib import admin
from django.urls import path, re_path, include
from django.conf import settings
import chat
import games
import chat, rps, minesweeper
from chat import consumers
from games import consumers
from rps import consumers
from minesweeper import consumers
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('common.urls')),
path('chat/', include('chat.urls')),
path('games/', include('games.urls')),
path('chess/', include('chess.urls'))
#path('chat/', include('chat.urls')),
#path('games/', include('games.urls')),
#path('chess/', include('chess.urls'))
*[path(game["url"] + "/", include(game["urls"])) for game in settings.VISIBLE_GAME_LINKS]
]
websocket_urlpatterns = [
re_path(r'ws/chat/(?P<room_name>\w+)/$', chat.consumers.ChatConsumer.as_asgi()),
path('rps/<id>', games.consumers.RPSConsumer.as_asgi()),
path('minesweeper/', games.consumers.MinesweeperConsumer.as_asgi())
path('rps/<id>', rps.consumers.RPSConsumer.as_asgi()),
path('minesweeper/', minesweeper.consumers.MinesweeperConsumer.as_asgi())
]

Loading…
Cancel
Save