Modified host value of database
This commit is contained in:
parent
8bdc94be04
commit
67fd153f2c
5 changed files with 12 additions and 165 deletions
|
|
@ -11,9 +11,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
||||||
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
DOTENV_FILE = BASE_DIR / '.env'
|
SECRET_KEY = os.environ.get('SECRET_KEY')
|
||||||
CONFIG = dotenv_values(DOTENV_FILE)
|
|
||||||
SECRET_KEY = CONFIG.get('SECRET_KEY')
|
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
@ -24,7 +22,8 @@ CSRF_COOKIE_SECURE = False
|
||||||
|
|
||||||
ALLOWED_HOSTS = [
|
ALLOWED_HOSTS = [
|
||||||
'45.79.52.230',
|
'45.79.52.230',
|
||||||
'housewars.c4thebomb101.com'
|
'housewars.c4thebomb101.com',
|
||||||
|
'collegiate-housewars.herokuapp.com'
|
||||||
]
|
]
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
@ -50,6 +49,7 @@ MIDDLEWARE = [
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
"whitenoise.middleware.WhiteNoiseMiddleware",
|
||||||
]
|
]
|
||||||
|
|
||||||
ROOT_URLCONF = 'CollegiateHouseWars.urls'
|
ROOT_URLCONF = 'CollegiateHouseWars.urls'
|
||||||
|
|
@ -80,9 +80,9 @@ DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.mysql',
|
'ENGINE': 'django.db.backends.mysql',
|
||||||
'NAME': 'housewars',
|
'NAME': 'housewars',
|
||||||
'USER': CONFIG.get('DATABASE_USERNAME'),
|
'USER': os.environ.get('DATABASE_USERNAME'),
|
||||||
'PASSWORD': CONFIG.get('DATABASE_PASSWORD'),
|
'PASSWORD': os.environ.get('DATABASE_PASSWORD'),
|
||||||
'HOST': 'localhost',
|
'HOST': os.environ.get('DATABASE_HOST'),
|
||||||
'PORT': '3306'
|
'PORT': '3306'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -123,7 +123,8 @@ USE_TZ = True
|
||||||
# https://docs.djangoproject.com/en/4.0/howto/static-files/
|
# https://docs.djangoproject.com/en/4.0/howto/static-files/
|
||||||
|
|
||||||
STATIC_URL = 'static/'
|
STATIC_URL = 'static/'
|
||||||
STATIC_ROOT = '/var/www/housewars/files/static/'
|
STATIC_ROOT = BASE_DIR / "staticfiles"
|
||||||
|
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
|
||||||
|
|
||||||
STATICFILES_DIRS = [
|
STATICFILES_DIRS = [
|
||||||
BASE_DIR / "static"
|
BASE_DIR / "static"
|
||||||
|
|
|
||||||
|
|
@ -1,138 +0,0 @@
|
||||||
from pathlib import Path
|
|
||||||
import os
|
|
||||||
from django.contrib.messages import constants
|
|
||||||
from dotenv import dotenv_values
|
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
|
||||||
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
|
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
|
||||||
DOTENV_FILE = BASE_DIR / '.env'
|
|
||||||
CONFIG = dotenv_values(DOTENV_FILE)
|
|
||||||
SECRET_KEY = CONFIG.get('SECRET_KEY')
|
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
|
||||||
DEBUG = True
|
|
||||||
|
|
||||||
SECURE_SSL_REDIRECT = False
|
|
||||||
SESSION_COOKIE_SECURE = False
|
|
||||||
CSRF_COOKIE_SECURE = False
|
|
||||||
|
|
||||||
ALLOWED_HOSTS = [
|
|
||||||
'localhost',
|
|
||||||
'127.0.0.1',
|
|
||||||
]
|
|
||||||
|
|
||||||
# Application definition
|
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
|
||||||
'django.contrib.admin',
|
|
||||||
'django.contrib.auth',
|
|
||||||
'django.contrib.contenttypes',
|
|
||||||
'django.contrib.sessions',
|
|
||||||
'django.contrib.messages',
|
|
||||||
'django.contrib.staticfiles',
|
|
||||||
|
|
||||||
'formtools',
|
|
||||||
|
|
||||||
'housewars.apps.HousewarsConfig'
|
|
||||||
]
|
|
||||||
|
|
||||||
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',
|
|
||||||
]
|
|
||||||
|
|
||||||
ROOT_URLCONF = 'CollegiateHouseWars.urls'
|
|
||||||
|
|
||||||
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',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
WSGI_APPLICATION = 'CollegiateHouseWars.wsgi.application'
|
|
||||||
|
|
||||||
|
|
||||||
# Database
|
|
||||||
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
|
|
||||||
|
|
||||||
DATABASES = {
|
|
||||||
'default': {
|
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
|
||||||
'NAME': '/var/www/housewars/db/db.sqlite3',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Password validation
|
|
||||||
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
|
|
||||||
|
|
||||||
AUTH_PASSWORD_VALIDATORS = [
|
|
||||||
{
|
|
||||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
# Internationalization
|
|
||||||
# https://docs.djangoproject.com/en/4.0/topics/i18n/
|
|
||||||
|
|
||||||
LANGUAGE_CODE = 'en-us'
|
|
||||||
|
|
||||||
TIME_ZONE = 'UTC'
|
|
||||||
|
|
||||||
USE_I18N = True
|
|
||||||
|
|
||||||
USE_TZ = True
|
|
||||||
|
|
||||||
|
|
||||||
# Static files (CSS, JavaScript, Images)
|
|
||||||
# https://docs.djangoproject.com/en/4.0/howto/static-files/
|
|
||||||
|
|
||||||
STATIC_URL = 'static/'
|
|
||||||
STATIC_ROOT = '/var/www/collegiate-housewars/static/'
|
|
||||||
|
|
||||||
STATICFILES_DIRS = [
|
|
||||||
BASE_DIR / "static"
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
# Default primary key field type
|
|
||||||
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
|
|
||||||
|
|
||||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|
||||||
|
|
||||||
|
|
||||||
MESSAGE_TAGS = {constants.DEBUG: 'debug',
|
|
||||||
constants.INFO: 'info',
|
|
||||||
constants.SUCCESS: 'success',
|
|
||||||
constants.WARNING: 'warning',
|
|
||||||
constants.ERROR: 'danger', }
|
|
||||||
2
Procfile
2
Procfile
|
|
@ -1 +1 @@
|
||||||
web: gunicorn django_project.wsgi
|
web: gunicorn CollegiateHouseWars.wsgi
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
|
||||||
app:
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
ports:
|
|
||||||
- 8000:8000
|
|
||||||
volumes:
|
|
||||||
- ./:/app
|
|
||||||
- housewars-sqlite3:/var/www/housewars/db
|
|
||||||
env_file: .env
|
|
||||||
environment:
|
|
||||||
DJANGO_SETTINGS_MODULE: "CollegiateHouseWars.settings.test"
|
|
||||||
command: python manage.py test
|
|
||||||
volumes:
|
|
||||||
housewars-sqlite3:
|
|
||||||
|
|
@ -2,10 +2,11 @@ asgiref==3.5.2
|
||||||
autopep8==1.6.0
|
autopep8==1.6.0
|
||||||
Django==4.0.4
|
Django==4.0.4
|
||||||
django-formtools==2.3
|
django-formtools==2.3
|
||||||
|
gunicorn==20.1.0
|
||||||
mysqlclient==2.1.1
|
mysqlclient==2.1.1
|
||||||
pycodestyle==2.8.0
|
pycodestyle==2.8.0
|
||||||
python-dotenv==0.20.0
|
python-dotenv==0.20.0
|
||||||
sqlparse==0.4.2
|
sqlparse==0.4.2
|
||||||
toml==0.10.2
|
toml==0.10.2
|
||||||
tzdata==2022.1
|
tzdata==2022.1
|
||||||
gunicorn==20.1.0
|
whitenoise==6.2.0
|
||||||
|
|
|
||||||
Reference in a new issue