rework settings stuff, README, env files
This commit is contained in:
parent
eb3f685938
commit
b2cf4cf9ae
|
@ -1,21 +0,0 @@
|
|||
MEDIA_ROOT="$DEV_DIR/media/"
|
||||
EPAY_MERCHANT_NUMBER="123"
|
||||
EPAY_MD5_SECRET="123"
|
||||
COINIFY_API_KEY="123"
|
||||
COINIFY_API_SECRET="123"
|
||||
COINIFY_IPN_SECRET="123"
|
||||
PDF_LETTERHEAD_FILENAME="bornhax.pdf"
|
||||
BANKACCOUNT_IBAN="femfladeflødeboller"
|
||||
BANKACCOUNT_SWIFTBIC="goldmansachs"
|
||||
BANKACCOUNT_REG="1234"
|
||||
BANKACCOUNT_ACCOUNT="56789"
|
||||
TICKET_CATEGORY_ID="304e9b44-0b48-472d-a05b-963e52614a69"
|
||||
SECRET_KEY="muchsecret"
|
||||
ALLOWED_HOSTS="127.0.0.1"
|
||||
EMAIL_HOST="localhost"
|
||||
EMAIL_PORT="22"
|
||||
EMAIL_HOST_USER="$USER"
|
||||
EMAIL_HOST_PASSWORD=""
|
||||
EMAIL_USE_TLS=""
|
||||
DEFAULT_FROM_EMAIL="bornhax@localhost"
|
||||
ARCHIVE_EMAIL=""
|
42
README.md
42
README.md
|
@ -1,44 +1,36 @@
|
|||
# Bornhack
|
||||
|
||||
Django project to power Bornhack.
|
||||
|
||||
Features do not include:
|
||||
- Create camp
|
||||
- Control expenses for a camp
|
||||
- Manage signups for attendees for a camp
|
||||
- ...
|
||||
Django project to power Bornhack. Features include news, villages, webshop, and more.
|
||||
|
||||
## Quickstart
|
||||
|
||||
### Virtualenv
|
||||
Create a Python 2.7 virtual environment and activate it:
|
||||
|
||||
$ virtualenv venv
|
||||
$ source venv/bin/activate
|
||||
|
||||
Install dependencies:
|
||||
### System libraries
|
||||
Install system dependencies (method depends on OS):
|
||||
- postgresql headers (for psychopg2)
|
||||
- libjpeg (for pdf generation)
|
||||
|
||||
### Python packages
|
||||
Install pip packages (pick either development or production):
|
||||
(venv) $ pip install -r requirements/development.txt
|
||||
(venv) $ pip install -r requirements/production.txt
|
||||
|
||||
Copy environment file and change settings like DATABASE_URL:
|
||||
|
||||
### Configuration file
|
||||
Copy environment file template and change settings:
|
||||
(venv) $ cp bornhack/settings/env.dist bornhack/settings/.env
|
||||
|
||||
Run `make` (removing USE_SQLITE=1 if you want to use postgres)
|
||||
|
||||
(venv) $ SQLITE=1 make
|
||||
|
||||
Which is equivalent with this:
|
||||
|
||||
### Database
|
||||
Is this a new installation? Initialize the database:
|
||||
(venv) $ ./manage.py migrate --settings=bornhack.settings.development
|
||||
(venv) $ ./manage.py createsuperuser --settings=bornhack.settings.development
|
||||
|
||||
### Done
|
||||
Is this for local development? Start the Django devserver:
|
||||
(venv) $ ./manage.py runserver --settings=bornhack.settings.development
|
||||
|
||||
### Setting up Postgres
|
||||
Otherwise start uwsgi or similar to serve the application.
|
||||
|
||||
Using Postgres is only necessary for purposes of the special
|
||||
[JSONField](https://docs.djangoproject.com/en/1.10/ref/contrib/postgres/fields/).
|
||||
The field is active on our shop mainly, so you can still develop things for most
|
||||
parts of the site without installing Postgres.
|
||||
|
||||
To use default settings and make commands, create a user `bornhack`, password
|
||||
`bornhack` and database `bornhack_dev` to use default setttings.
|
||||
|
|
32
bornhack/settings/.env.dist
Normal file
32
bornhack/settings/.env.dist
Normal file
|
@ -0,0 +1,32 @@
|
|||
### set database url and allowed_hosts here
|
||||
DATABASE_URL=postgres://username:password@host:port/database
|
||||
ALLOWED_HOSTS=localhost,127.0.0.1
|
||||
|
||||
### changes below here are only needed for production
|
||||
SECRET_KEY=somethingverysecretandunique
|
||||
|
||||
EMAIL_HOST='mailhost.example.com'
|
||||
EMAIL_PORT=587
|
||||
EMAIL_HOST_USER='mymailuser'
|
||||
EMAIL_HOST_PASSWORD='mymailpassword'
|
||||
EMAIL_USE_TLS=True
|
||||
DEFAULT_FROM_EMAIL='noreply@example.com'
|
||||
ARCHIVE_EMAIL='archive@example.com'
|
||||
|
||||
ADMINS=(
|
||||
('bornhack sysadm', 'sysadm@bornhack.org'),
|
||||
)
|
||||
|
||||
EPAY_MERCHANT_NUMBER=123
|
||||
EPAY_MD5_SECRET='abc'
|
||||
TICKET_CATEGORY_ID='304e9b44-0b48-472d-a05b-963e52614a69'
|
||||
COINIFY_API_KEY='123'
|
||||
COINIFY_API_SECRET='123'
|
||||
COINIFY_IPN_SECRET='123'
|
||||
PDF_LETTERHEAD_FILENAME='letterhead.pdf'
|
||||
MEDIA_ROOT='/path/to/media/root/outside/django/root/'
|
||||
BANKACCOUNT_IBAN='123'
|
||||
BANKACCOUNT_SWIFTBIC='123'
|
||||
BANKACCOUNT_REG='123'
|
||||
BANKACCOUNT_ACCOUNT='123'
|
||||
|
|
@ -13,8 +13,15 @@ def local_dir(entry):
|
|||
WSGI_APPLICATION = 'bornhack.wsgi.application'
|
||||
ROOT_URLCONF = 'bornhack.urls'
|
||||
|
||||
SECRET_KEY = env('SECRET_KEY')
|
||||
ALLOWED_HOSTS = env('ALLOWED_HOSTS').split(',')
|
||||
|
||||
SITE_ID = 1
|
||||
|
||||
DATABASES = {
|
||||
'default': env.db(),
|
||||
}
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
|
@ -40,7 +47,6 @@ INSTALLED_APPS = [
|
|||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = local_dir('static')
|
||||
STATICFILES_DIRS = [local_dir('static_src')]
|
||||
#MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = env('MEDIA_ROOT')
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
TIME_ZONE = 'UTC'
|
||||
|
|
|
@ -1,28 +1,11 @@
|
|||
import os
|
||||
from .base import *
|
||||
import environ
|
||||
env = environ.Env()
|
||||
environ.Env.read_env()
|
||||
|
||||
DEBUG = True
|
||||
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||
|
||||
# INSTALLED_APPS += ['debug_toolbar', ]
|
||||
|
||||
SECRET_KEY = 'bornhack_development'
|
||||
DEBUG = True
|
||||
|
||||
if os.environ.get('USE_SQLITE'):
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': local_dir('../.dev/dev.db'),
|
||||
}
|
||||
}
|
||||
else:
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': 'bornhack_dev',
|
||||
'USER': 'bornhack',
|
||||
'PASSWORD': 'bornhack',
|
||||
'HOST': 'localhost',
|
||||
'PORT': 5432,
|
||||
}
|
||||
}
|
||||
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||
|
|
|
@ -1,17 +1,9 @@
|
|||
from .base import *
|
||||
import environ
|
||||
|
||||
env = environ.Env()
|
||||
|
||||
environ.Env.read_env()
|
||||
|
||||
DEBUG = False
|
||||
SECRET_KEY = env('SECRET_KEY')
|
||||
ALLOWED_HOSTS = env('ALLOWED_HOSTS').split(',')
|
||||
|
||||
DATABASES = {
|
||||
'default': env.db(),
|
||||
}
|
||||
|
||||
EMAIL_HOST = env('EMAIL_HOST')
|
||||
EMAIL_PORT = env('EMAIL_PORT')
|
||||
|
@ -44,7 +36,5 @@ LOGGING = {
|
|||
}
|
||||
}
|
||||
|
||||
ADMINS = (
|
||||
('bornhack sysadm', 'sysadm@bornhack.org'),
|
||||
)
|
||||
ADMINS = env('ADMINS')
|
||||
|
||||
|
|
Loading…
Reference in a new issue