Skip to content
Snippets Groups Projects
Commit 75f5ba62 authored by Jan Maximilian Michal's avatar Jan Maximilian Michal
Browse files

Restructured settings dev/live

parent ea0d91d9
No related branches found
No related tags found
No related merge requests found
import os
dev = os.environ.get('DJANGO_DEV', False)
from .default import *
if not dev:
from .live import *
......@@ -15,8 +15,7 @@ import os
from django.contrib.messages import constants as messages
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
......@@ -79,7 +78,7 @@ WSGI_APPLICATION = 'grady.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'NAME': os.path.join(BASE_DIR, '../db.sqlite3'),
}
}
......@@ -121,6 +120,7 @@ USE_TZ = True
# https://docs.djangoproject.com/en/1.10/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
FIXTURE_DIRS = ['/core/fixtures/']
......
# Some deploy settings to enhance security
CSRF_COOKIE_SECURE = True
CSRF_COOKIE_HTTPONLY = True
SESSION_COOKIE_SECURE = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
X_FRAME_OPTIONS = 'DENY'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
# adjust this setting to your needs
ALLOWED_HOSTS = ['localhost', 'grady.janmax.org']
# sample postgre sql database configuration
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': '__database_name',
'USER': '__database_name_user',
'PASSWORD': 'secret',
'HOST': 'localhost',
'PORT': '',
},
}
......@@ -132,7 +132,9 @@ def add_auto_feedback(submission, compiler_output):
return Feedback.DID_NOT_COMPILE, Feedback.NEEDS_REVIEW
elif compiler_output.endswith('COULD NOT LINK'):
return Feedback.COULD_NOT_LINK, Feedback.NEEDS_REVIEW
elif not compiler_output:
elif compiler_output.endswith('WARNINGS'):
return None, None
else:
return None, None
auto_correct, _ = User.objects.get_or_create(username='auto_correct')
......@@ -271,12 +273,11 @@ if __name__ == '__main__':
args = parseme()
print("Starting population script...")
try:
login_data_f = open('login_data.csv', 'a')
if os.stat('login_data.csv').st_size == 0:
login_data_f = open('login_data.csv', 'w')
login_writer = csv.writer(login_data_f)
login_writer.writerow(['username', 'password'])
else:
login_data_f = open('login_data.csv', 'a')
login_writer = csv.writer(login_data_f)
PopulateDatabase(args)
finally:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment