Created
April 16, 2020 04:02
-
-
Save rg3915/2f04f3949c8f4284142ff96de5e6deef to your computer and use it in GitHub Desktop.
django settings snippets
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 decouple import config, Csv | |
| from dj_database_url import parse as dburl | |
| BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| # SECURITY WARNING: keep the secret key used in production secret! | |
| SECRET_KEY = config('SECRET_KEY') | |
| # SECURITY WARNING: don't run with debug turned on in production! | |
| DEBUG = config('DEBUG', default=False, cast=bool) | |
| ALLOWED_HOSTS = config('ALLOWED_HOSTS', default=[], cast=Csv()) | |
| # Application definition | |
| INSTALLED_APPS = [ | |
| 'django.contrib.admin', | |
| 'django.contrib.auth', | |
| 'django.contrib.contenttypes', | |
| 'django.contrib.sessions', | |
| 'django.contrib.messages', | |
| 'django.contrib.staticfiles', | |
| # third_apps | |
| 'django_extensions', | |
| # my_apps | |
| 'myproject.core' | |
| ] | |
| ... | |
| # Database | |
| # https://docs.djangoproject.com/en/2.2/ref/settings/#databases | |
| default_dburl = 'sqlite:///' + os.path.join(BASE_DIR, 'db.sqlite3') | |
| DATABASES = { | |
| 'default': config('DATABASE_URL', default=default_dburl, cast=dburl), | |
| } | |
| ... | |
| # Internationalization | |
| # https://docs.djangoproject.com/en/2.2/topics/i18n/ | |
| LANGUAGE_CODE = 'pt-br' | |
| TIME_ZONE = 'America/Sao_Paulo' | |
| USE_I18N = True | |
| USE_L10N = True | |
| USE_TZ = True | |
| USE_THOUSAND_SEPARATOR = True | |
| # Static files (CSS, JavaScript, Images) | |
| # https://docs.djangoproject.com/en/2.2/howto/static-files/ | |
| STATIC_URL = '/static/' | |
| STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment