Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed settings.py #661

Open
wants to merge 1 commit into
base: melnik_e
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
.idea/
__pycache__
venv/
courses_logger.log
students_logger.log
*.log
local_settings.py
119 changes: 119 additions & 0 deletions pybursa/local_settings_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
"""
Django settings for pybursa project.

Generated by 'django-admin startproject' using Django 1.10.

For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = 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/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 's0+w5fxsnw9b42cayh7=!--%x(-6nz)r04d&m#mjiwcjjcos*a'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False

ALLOWED_HOSTS = []


# Application definition

EMAIL_HOST = "127.0.0.1"
EMAIL_PORT = "1025"
ADMINS = [('John', '[email protected]'), ('Mary', '[email protected]')]
WSGI_APPLICATION = 'pybursa.wsgi.application'

LOGGING = {
'version': 1,
#'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(funcName)s %(message)s'
},
'simple': {
'format': '%(levelname)s %(message)s'
},
},
'handlers': {
'file1': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'formatter': 'simple',
'filename': os.path.join(BASE_DIR,'courses_logger.log'),
},
'file2': {
'level': 'WARNING',
'class': 'logging.FileHandler',
'formatter': 'verbose',
'filename': os.path.join(BASE_DIR,'students_logger.log'),
},
},
'loggers': {
'pybursa.courses': {
'handlers': ['file1'],
'level': 'DEBUG',
#'propagate': True,
},
'pybursa.students': {
'handlers': ['file2'],
'level': 'WARNING',
#'propagate': True,
},
},
}

# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}


# Password validation
# https://docs.djangoproject.com/en/1.10/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/1.10/topics/i18n/



# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/

STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
'/static/pybursa/',
]
8 changes: 8 additions & 0 deletions pybursa/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,15 @@
# https://docs.djangoproject.com/en/1.10/howto/static-files/

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
'/static/pybursa/',
]
try:

from local_settings import *

except ImportError:

print(“Warning! local_settings are not defined!”)