mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-22 09:31:08 +00:00
commit
d4a090ae1f
8 changed files with 63 additions and 9 deletions
18
.env.example
Normal file
18
.env.example
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
export SECRET_KEY="7(2w1sedok=aznpq)ta1mc4i%4h=xx@hxwx*o57ctsuml0x%fr"
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
export DEBUG=true
|
||||||
|
|
||||||
|
export DOMAIN=your.domain.here
|
||||||
|
|
||||||
|
## Leave unset to allow all hosts
|
||||||
|
# export ALLOWED_HOSTS="localhost,127.0.0.1,[::1]"
|
||||||
|
|
||||||
|
export OL_URL="https://openlibrary.org"
|
||||||
|
|
||||||
|
## Database backend to use.
|
||||||
|
## Default is postgres, use sqlite is for dev quickstart only (NOT production!!!)
|
||||||
|
export FEDIREADS_DATABASE_BACKEND=postgres
|
||||||
|
|
||||||
|
export MEDIA_ROOT="images/"
|
12
.gitignore
vendored
12
.gitignore
vendored
|
@ -1,3 +1,15 @@
|
||||||
|
# Python
|
||||||
/venv
|
/venv
|
||||||
*.pyc
|
*.pyc
|
||||||
*.swp
|
*.swp
|
||||||
|
|
||||||
|
# VSCode
|
||||||
|
/.vscode
|
||||||
|
|
||||||
|
# sqlite
|
||||||
|
.db
|
||||||
|
.db-journal
|
||||||
|
|
||||||
|
# Fedireads
|
||||||
|
.env
|
||||||
|
images/
|
|
@ -26,7 +26,7 @@ This creates two users, `mouse` with password `password123` and `rat` with passw
|
||||||
|
|
||||||
And go to the app at `localhost:8000`
|
And go to the app at `localhost:8000`
|
||||||
|
|
||||||
For most testing, you'll want to use ngrok. Remember to set the DOMAIN in settings.py to your ngrok domain.
|
For most testing, you'll want to use ngrok. Remember to set the DOMAIN in `.env` to your ngrok domain.
|
||||||
|
|
||||||
|
|
||||||
## Structure
|
## Structure
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
''' fedireads settings and configuration '''
|
''' fedireads settings and configuration '''
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from environs import Env
|
||||||
|
|
||||||
|
env = Env()
|
||||||
|
|
||||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
|
@ -8,15 +12,15 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/2.0/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 = '7(2w1sedok=aznpq)ta1mc4i%4h=xx@hxwx*o57ctsuml0x%fr'
|
SECRET_KEY = env('SECRET_KEY')
|
||||||
|
|
||||||
# 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 = env.bool('DEBUG', True)
|
||||||
|
|
||||||
# TODO: annoying that I keep changing and re-commiting this
|
# TODO: annoying that I keep changing and re-commiting this
|
||||||
DOMAIN = '26863dc9.ngrok.io'
|
DOMAIN = env('DOMAIN')
|
||||||
ALLOWED_HOSTS = ['*']
|
ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', ['*'])
|
||||||
OL_URL = 'https://openlibrary.org'
|
OL_URL = env('OL_URL')
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
|
@ -66,8 +70,10 @@ WSGI_APPLICATION = 'fedireads.wsgi.application'
|
||||||
# Database
|
# Database
|
||||||
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
|
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
|
||||||
|
|
||||||
DATABASES = {
|
FEDIREADS_DATABASE_BACKEND = env('FEDIREADS_DATABASE', 'postgres')
|
||||||
'default': {
|
|
||||||
|
FEDIREADS_DBS = {
|
||||||
|
'postgres': {
|
||||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||||
'NAME': 'fedireads',
|
'NAME': 'fedireads',
|
||||||
'USER': 'fedireads',
|
'USER': 'fedireads',
|
||||||
|
@ -77,6 +83,10 @@ DATABASES = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': FEDIREADS_DBS[FEDIREADS_DATABASE_BACKEND]
|
||||||
|
}
|
||||||
|
|
||||||
LOGIN_URL = '/login/'
|
LOGIN_URL = '/login/'
|
||||||
AUTH_USER_MODEL = 'fedireads.User'
|
AUTH_USER_MODEL = 'fedireads.User'
|
||||||
|
|
||||||
|
@ -118,4 +128,4 @@ USE_TZ = True
|
||||||
|
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/static/'
|
||||||
MEDIA_URL = '/images/'
|
MEDIA_URL = '/images/'
|
||||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'images/')
|
MEDIA_ROOT = os.path.join(BASE_DIR, env('MEDIA_ROOT', 'images/'))
|
||||||
|
|
|
@ -9,8 +9,12 @@ https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from environs import Env
|
||||||
|
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
|
Env.read_env()
|
||||||
|
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fedireads.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fedireads.settings")
|
||||||
|
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from environs import Env
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Env.read_env() # load environment variables from .env
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fedireads.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fedireads.settings")
|
||||||
try:
|
try:
|
||||||
from django.core.management import execute_from_command_line
|
from django.core.management import execute_from_command_line
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
if [ ! -f .env ]; then
|
||||||
|
echo "No .env found -- copying .example.env to .env!"
|
||||||
|
cp .env.example .env
|
||||||
|
fi
|
||||||
|
|
||||||
dropdb fedireads
|
dropdb fedireads
|
||||||
createdb fedireads
|
createdb fedireads
|
||||||
python manage.py makemigrations fedireads
|
python manage.py makemigrations fedireads
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
Django==3.0.3
|
Django==3.0.3
|
||||||
django-model-utils==4.0.0
|
django-model-utils==4.0.0
|
||||||
|
environs==7.2.0
|
||||||
Pillow==7.0.0
|
Pillow==7.0.0
|
||||||
psycopg2==2.8.4
|
psycopg2==2.8.4
|
||||||
pycryptodome==3.9.4
|
pycryptodome==3.9.4
|
||||||
|
|
Loading…
Reference in a new issue