diff --git a/manage.py b/manage.py index 68624d6..4e5c195 100644 --- a/manage.py +++ b/manage.py @@ -3,8 +3,8 @@ import sys if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "openra.settings") + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "openra.settings") - from django.core.management import execute_from_command_line + from django.core.management import execute_from_command_line - execute_from_command_line(sys.argv) + execute_from_command_line(sys.argv) diff --git a/openra/settings.py.example b/openra/settings.py.example index 7e66f4a..50d3a37 100644 --- a/openra/settings.py.example +++ b/openra/settings.py.example @@ -30,72 +30,72 @@ ALLOWED_HOSTS = ['*'] SITE_ID = 1 ACCOUNT_EMAIL_REQUIRED = True -SESSION_COOKIE_AGE = 7776000 # 90 days for active user session +SESSION_COOKIE_AGE = 7776000 # 90 days for active user session AUTHENTICATION_BACKENDS = ( - # Needed to login by username in Django admin, regardless of `allauth` - "django.contrib.auth.backends.ModelBackend", - # `allauth` specific authentication methods, such as login by e-mail - "allauth.account.auth_backends.AuthenticationBackend", + # Needed to login by username in Django admin, regardless of `allauth` + "django.contrib.auth.backends.ModelBackend", + # `allauth` specific authentication methods, such as login by e-mail + "allauth.account.auth_backends.AuthenticationBackend", ) # Application definition INSTALLED_APPS = [ - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'django.contrib.humanize', - 'openra', - 'registration', - 'django.contrib.sites', - 'allauth', - 'allauth.account', - 'allauth.socialaccount', - 'allauth.socialaccount.providers.github', - 'allauth.socialaccount.providers.google', - 'corsheaders', + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'django.contrib.humanize', + 'openra', + 'registration', + 'django.contrib.sites', + 'allauth', + 'allauth.account', + 'allauth.socialaccount', + 'allauth.socialaccount.providers.github', + 'allauth.socialaccount.providers.google', + 'corsheaders', ] MIDDLEWARE_CLASSES = [ - 'django.middleware.security.SecurityMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', - 'corsheaders.middleware.CorsMiddleware', + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'corsheaders.middleware.CorsMiddleware', ] CORS_ORIGIN_ALLOW_ALL = True CORS_ALLOW_METHODS = ( - 'GET', - 'POST', + 'GET', + 'POST', ) ROOT_URLCONF = 'openra.urls' TEMPLATES = [ - { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], - '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', - - 'django.contrib.auth.context_processors.auth', - ], - }, - }, + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + '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', + + 'django.contrib.auth.context_processors.auth', + ], + }, + }, ] WSGI_APPLICATION = 'openra.wsgi.application' @@ -105,13 +105,13 @@ WSGI_APPLICATION = 'openra.wsgi.application' # https://docs.djangoproject.com/en/1.9/ref/settings/#databases DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': '', - 'USER': '', - 'PASSWORD': '', - 'HOST': 'localhost', - } + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': '', + 'USER': '', + 'PASSWORD': '', + 'HOST': 'localhost', + } } @@ -119,18 +119,18 @@ DATABASES = { # https://docs.djangoproject.com/en/1.9/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', - }, + { + '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', + }, ] @@ -157,9 +157,9 @@ STATIC_URL = '/static/' ACCOUNT_ACTIVATION_DAYS = 7 -########################### -##### CUSTOM SETTINGS ##### -########################### +################### +# CUSTOM SETTINGS # +################### # Path to directory where OpenRA versions are stored @@ -167,10 +167,10 @@ OPENRA_ROOT_PATH = '' # OpenRA Versions matching their directory names OPENRA_VERSIONS = { - 3: 'release-20151224', - 2: 'release-20150919', - 1: 'release-20150614', - 0: 'bleed', # just a name, see OPENRA_BLEED_PARSER setting + 3: 'release-20151224', + 2: 'release-20150919', + 1: 'release-20150614', + 0: 'bleed', # just a name, see OPENRA_BLEED_PARSER setting } # Path to file which stores HASH of the latest `bleed` version @@ -186,7 +186,6 @@ OPENRA_BLEED_PARSER = '' RSYNC_MAP_PATH = '' - # Email address (FROM) in our custom mail methods ADMIN_EMAIL_FROM = '' @@ -197,16 +196,13 @@ ADMIN_EMAIL_TO = '' DEFAULT_FROM_EMAIL = '' - # Determining amount of reports for item, required to forbid in-game downloading, synchronization with servers, etc. REPORTS_PENALTY_AMOUNT = 3 - # Is site under maintenance -SITE_MAINTENANCE = False -SITE_MAINTENANCE_OVER = '00:00 GMT' # when we finish technical works - +SITE_MAINTENANCE = False +SITE_MAINTENANCE_OVER = '00:00 GMT' # when we finish technical works # Time limit for some execution processes diff --git a/openra/wsgi.py b/openra/wsgi.py index 3d140c2..4700128 100644 --- a/openra/wsgi.py +++ b/openra/wsgi.py @@ -8,16 +8,19 @@ """ import os -import logging, sys +import logging +import sys +from django.core.wsgi import get_wsgi_application + logging.basicConfig(stream=sys.stderr) BASE_DIR = os.path.dirname(os.path.dirname(__file__)) + sys.path.append(BASE_DIR) os.chdir(BASE_DIR) -from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "openra.settings")