Django Configuration

deby edited this page Mar 19, 2016 · 2 revisions

school idol tomodachi

List of features

School Idol Tomodachi Cards

School Idol Tomodachi Profile

School Idol Tomodachi Activities

School Idol Tomodachi Events

School Idol Festival, the game

Contact us

Help us!

Developers

Clone this wiki locally

Configure

To use your own configuration values, create a file schoolidolapi/local_settings.py and never commit it to the repo.

You may need to override those values:

In a production environment
# Production Basics
SECRET_KEY = 'random generated string to change in production'
TRANSFER_CODE_SECRET_KEY = 'random generated string used to encrypt transfer codes'
DEBUG = False
TEMPLATE_DEBUG = False
ALLOWED_HOSTS = ['schoolido.lu']

# Production S3 (file storage)
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
AWS_ACCESS_KEY_ID = ''
AWS_SECRET_ACCESS_KEY = ''
AWS_STORAGE_BUCKET_NAME = 'schoolido.lu-assets'
IMAGES_HOSTING_PATH = 'http://s3-ap-northeast-1.amazonaws.com/schoolido.lu-assets/'

# Production SES (emails)
EMAIL_BACKEND = 'django_ses.SESBackend'
AWS_SES_REGION_NAME = 'us-east-1'
AWS_SES_REGION_ENDPOINT = 'email.us-east-1.amazonaws.com'
AWS_SES_RETURN_PATH = 'contact@schoolido.lu'
AWS_PASSWORD_EMAIL = 'password@schoolido.lu'

# Shrink images using tinypng API
TINYPNG_API_KEY = ''

# Use MySQL database (and not sqlite by default)
DATABASES = {
    'default': {
                    'ENGINE': 'django.db.backends.mysql',
                    'NAME': 'schoolidolu',
                    'OPTIONS': {'charset': 'utf8mb4'},
                    'USER': 'root',
                    'PASSWORD': '',
                    'HOST': 'localhost',
                    'PORT': '3306',
                }
}
In a testing environment
# To log all the 500 errors in the terminal:
LOGGING = {
    'disable_existing_loggers': False,
    'version': 1,
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
            'level': 'DEBUG',
        },
    },
    'loggers': {
        'django.request': {
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': True,
        },
    },
}


# To log all the database queries (useful for optimization):
LOGGING = {
    'disable_existing_loggers': False,
    'version': 1,
    'handlers': {
        'console': {
                        # logging handler that outputs log messages to terminal
            'class': 'logging.StreamHandler',
            'level': 'DEBUG', # message level to be written to console
                    },
            },
    'loggers': {
        '': {
                        # this sets root level logger to log debug and higher level
                                    # logs to console. All other loggers inherit settings from
                                                # root level logger.
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': False, # this tells logger to send logging message
                                            # to its parent (will send if set to True)
                                                    },
        'django.db': {
                        # django also has database level logging
                                },
            },
    }