mirror of
https://github.com/Sosokker/ku-polls.git
synced 2025-12-18 21:14:05 +01:00
Externalize DEBUG, TIMEZONE, ALLOW_HOST and Add Install instruction in README.md
This commit is contained in:
parent
e0c7995f28
commit
d61dd2ce4b
@ -28,6 +28,8 @@ or
|
|||||||
|
|
||||||
**Don't forget to change `your_secret_key` to your secret key (without quote)**
|
**Don't forget to change `your_secret_key` to your secret key (without quote)**
|
||||||
|
|
||||||
|
**You can look at `sample.env` for more information and others environment variables to set.**
|
||||||
|
|
||||||
4. Run these commands
|
4. Run these commands
|
||||||
```bash
|
```bash
|
||||||
python manage.py migrate
|
python manage.py migrate
|
||||||
|
|||||||
@ -11,7 +11,7 @@ https://docs.djangoproject.com/en/4.2/ref/settings/
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from decouple import config
|
from decouple import config, Csv
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
@ -20,14 +20,15 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
|||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
#! SECURITY WARNING: keep the secret key used in production secret!
|
||||||
SECRET_KEY = config('SECRET_KEY', default='fake-secret-key')
|
SECRET_KEY = config('SECRET_KEY', default='k2pd1p)zwe0qy0k25=sli+7+n^vd-0h*&6vga6oldq=781+7qw')
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
#! SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = True
|
DEBUG = config('DEBUG', default=False, cast=bool)
|
||||||
|
|
||||||
ALLOWED_HOSTS = []
|
ALLOWED_HOSTS = config('ALLOWED_HOSTS', default='*', cast=Csv())
|
||||||
|
|
||||||
|
TIME_ZONE = config('TIME_ZONE', default='Asia/Bangkok', cast=str)
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
|
|||||||
10
sample.env
Normal file
10
sample.env
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Copy this file to .env and edit the values
|
||||||
|
# Create a secret key using (todo: how to create a secret key?)
|
||||||
|
SECRET_KEY = secret-key-value-without-quotes
|
||||||
|
# Set DEBUG to True for development, False for actual use
|
||||||
|
DEBUG = False
|
||||||
|
# ALLOWED_HOSTS is a comma-separated list of hosts that can access the app.
|
||||||
|
# You can use wildcard chars (*) and IP addresses. Use * for any host.
|
||||||
|
ALLOWED_HOSTS = *.ku.th, localhost, 127.0.0.1, ::1
|
||||||
|
# Your timezone
|
||||||
|
TIME_ZONE = Asia/Bangkok
|
||||||
Loading…
Reference in New Issue
Block a user