changes for production

This commit is contained in:
Bossanyi Tibor
2020-07-23 22:09:55 +02:00
parent fc4a56e369
commit a1b018d52c
13 changed files with 110 additions and 31 deletions
@@ -89,3 +89,5 @@ class ExerciseTreeAdmin(admin.ModelAdmin):
admin.site.register(ExerciseType, ExerciseTypeAdmin)
admin.site.register(ExerciseTree, ExerciseTreeAdmin)
admin.autodiscover()
@@ -1,6 +0,0 @@
from django.apps import AppConfig
class BackofficeConfig(AppConfig):
name = "aitrainer_backoffice"
@@ -29,7 +29,7 @@ ALLOWED_HOSTS = ['localhost']
# Application definition
INSTALLED_APPS = [
'aitrainer_backoffice.apps.BackofficeConfig',
'aitrainer_backoffice',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
@@ -19,17 +19,17 @@ 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 = os.environ['DJANGO_KEY']
+SECRET_KEY = '9874959872==9847588jkklnkln$asdf' #os.environ['DJANGO_KEY']
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
DEBUG = True
ALLOWED_HOSTS = ['localhost', 'andio.eu', 'aitrainer.*']
+ALLOWED_HOSTS = ['62.171.188.119', 'localhost', 'andio.eu', 'aitrainer.info','aitrainer.app']
# Application definition
INSTALLED_APPS = [
'aitrainer_backoffice.apps.BackofficeConfig',
#'aitrainer_backoffice',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
@@ -77,8 +77,8 @@ DATABASES = {
'NAME': 'aitrainer',
'USER': 'aitrainer',
'PASSWORD': 'andio2009',
'HOST': '127.0.0.1',
'PORT': 3306
'HOST': '62.171.188.119',
'PORT': 33060
}
}
@@ -117,6 +117,7 @@ USE_TZ = True
# https://docs.djangoproject.com/en/3.0/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "static")
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
@@ -130,30 +131,25 @@ LOGGING = {
},
},
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'filters': ['require_debug_true'],
},
'file': {
'level': 'ERROR',
'class': 'logging.FileHandler',
'filename': '/var/log/django_error.log',
}
},
'loggers': {
'mylogger': {
'handlers': {
'file': {
'level': 'ERROR',
'class': 'logging.FileHandler',
'filename': '/var/log/django_error.log',
},
},
'level': os.getenv('DJANGO_LOG_LEVEL', 'ERROR'),
'django': {
'handlers': ['file'],
'level': 'DEBUG',
'propagate': True,
},
},
}
# deployment settings
SECURE_SSL_REDIRECT = False
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
#SECURE_SSL_REDIRECT = False
#SESSION_COOKIE_SECURE = True
#CSRF_COOKIE_SECURE = True
CACHES = {
'default': {
@@ -18,10 +18,10 @@ Including another URLconf
from django.contrib import admin
from django.urls import path, include
from . import views
from django.conf import settings #
from django.conf.urls.static import static # n
urlpatterns = [
path('admin/', admin.site.urls),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+1 -1
View File
@@ -5,7 +5,7 @@ import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'aitrainer_backoffice.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'aitrainer_backoffice.settings.dev')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
+1
View File
@@ -0,0 +1 @@
python manage.py runserver --settings aitrainer_backoffice.settings.dev