This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python manage.py runserver --settings=settings.local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run job for getting new tweets. | |
# Accept string in crontab format. By default: every 30 minutes. | |
MYAWESOMEPROJECT_TWEETS_API_SYNC_CRONTAB = env.str( | |
'MYAWESOMEPROJECT_TWEETS_API_SYNC_CRONTAB', default='30 * * * *' | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
API_SYNC_CRONTAB = env.str('API_SYNC_CRONTAB') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from .django import * # All Django related settings | |
from .third_party import * # Celery, Django REST Framework & other 3rd parties | |
from .project import * # You custom settings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DEBUG=True | |
DATABASE_URL=postgres://user:[email protected]:5432/production_db?sslmode=require | |
REDIS_CACHE_URL=redis://user:[email protected]:6379/1 | |
SECRET_KEY=Some-Autogenerated-Secret-Key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import environ | |
root = environ.Path(__file__) - 3 # get root of the project | |
env = environ.Env() | |
environ.Env.read_env() # reading .env file | |
SITE_ROOT = root() | |
DEBUG = env.bool('DEBUG', default=False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
SITE_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) | |
DEBUG = True | |
TEMPLATE_DEBUG = DEBUG | |
DATABASES = { | |
'default': { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from django.core.exceptions import ImproperlyConfigured | |
def get_env_value(env_variable): | |
try: | |
return os.environ[env_variable] | |
except KeyError: | |
error_msg = 'Set the {} environment variable'.format(var_name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
SECRET_KEY = os.environ['SECRET_KEY'] | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.postgresql', | |
'NAME': os.environ['DATABASE_NAME'], | |
'HOST': os.environ['DATABASE_HOST'], | |
'PORT': int(os.environ['DATABASE_PORT']), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from .base import * | |
ALLOWED_HOSTS = ['localhost'] | |
DEBUG = True | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.postgresql', | |
'NAME': 'local_db', | |
'HOST': '127.0.0.1', |
NewerOlder