mirror of
https://github.com/chibicitiberiu/ytsm.git
synced 2024-02-24 05:43:31 +00:00
Environment Variables and Docker standalone support (#21)
* Ignore .dist folder used by visual studio code * Add example env file * Added environment variables * Ignore env file * Added default name to be ytmanager instead * Default to postgres * Update example env for postgres instead of sqlite * Added default as postgres as well in settings * Add volume for sqlite3 database storage (incase desired) * Added example env file for sqlite3 configuration * whitespace for sanity of my own * Add database_url as an optional env variable * hopefully working towards chibicitiberiu/ytsm#6 * Added default command * Expose 8000 * Added environment variable prefixes * added environment variable to parse for dj_database_url * Take out command in docker-compose since it's already in the Dockerfile as a cmd * SQLite as default * Create Docker README with information about how to run with Docker * Took out postgres. If people desire it, they can add it themselves. * Took out db depenednecy for docker-compose * Change cmd * Fixed up commands to run better in readme * Added underscore to Docker_README * Change default .db file location
This commit is contained in:
@ -21,7 +21,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = '^zv8@i2h!ko2lo=%ivq(9e#x=%q*i^^)6#4@(juzdx%&0c+9a0'
|
||||
|
||||
YOUTUBE_API_KEY = "AIzaSyBabzE4Bup77WexdLMa9rN9z-wJidEfNX8"
|
||||
YOUTUBE_API_KEY = os.getenv('YTSM_YOUTUBE_API_KEY', 'AIzaSyBabzE4Bup77WexdLMa9rN9z-wJidEfNX8')
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
@ -81,15 +81,19 @@ WSGI_APPLICATION = 'YtManager.wsgi.application'
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': 'postgres',
|
||||
'USER': 'postgres',
|
||||
'HOST': 'db',
|
||||
'PORT': 5432,
|
||||
'ENGINE': os.getenv('YTSM_DATABASE_ENGINE', 'django.db.backends.postgresql'),
|
||||
'NAME': os.getenv('YTSM_DATABASE_NAME', os.path.join(BASE_DIR, 'ytmanager.db')),
|
||||
'HOST': os.getenv('YTSM_DATABASE_HOST', None),
|
||||
'USER': os.getenv('YTSM_DATABASE_USERNAME', None),
|
||||
'PASSWORD': os.getenv('YTSM_DATABASE_PASSWORD', None),
|
||||
'PORT': os.getenv('YTSM_DATABASE_PORT', None)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if os.getenv('YTSM_DATABASE_URL', None):
|
||||
import dj_database_url
|
||||
DATABASES['default'] = dj_database_url.parse(os.environ['YTSM_DATABASE_URL'], conn_max_age=600)
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
|
||||
|
||||
|
Reference in New Issue
Block a user