Merge pull request #75 from benjaoming/dev-improvements
Dev improvements
This commit is contained in:
commit
8aef2064e6
21
.env_template
Executable file
21
.env_template
Executable file
|
@ -0,0 +1,21 @@
|
|||
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=""
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
.dev
|
||||
.idea/
|
||||
__pycache__/
|
||||
db.sqlite3
|
||||
|
|
8
Makefile
8
Makefile
|
@ -3,15 +3,15 @@ SETTINGS = bornhack.settings.development
|
|||
all: migrate superuser run
|
||||
|
||||
migrations:
|
||||
./manage.py makemigrations --settings=$(SETTINGS)
|
||||
./dev.sh makemigrations --settings=$(SETTINGS)
|
||||
|
||||
migrate:
|
||||
./manage.py migrate --settings=$(SETTINGS)
|
||||
./dev.sh migrate --settings=$(SETTINGS)
|
||||
|
||||
superuser:
|
||||
./manage.py createsuperuser --settings=$(SETTINGS)
|
||||
./dev.sh createsuperuser --settings=$(SETTINGS)
|
||||
|
||||
run:
|
||||
./manage.py runserver --settings=$(SETTINGS)
|
||||
./dev.sh runserver --settings=$(SETTINGS)
|
||||
|
||||
.PHONY = all migrations migrate superuser run
|
||||
|
|
17
README.md
17
README.md
|
@ -10,8 +10,7 @@ Features do not include:
|
|||
|
||||
## Quickstart
|
||||
|
||||
|
||||
Create a virtual environment and activate it:
|
||||
Create a Python 2.7 virtual environment and activate it:
|
||||
|
||||
$ virtualenv venv
|
||||
$ source venv/bin/activate
|
||||
|
@ -24,12 +23,22 @@ Copy environment file and change settings like DATABASE_URL:
|
|||
|
||||
(venv) $ cp bornhack/settings/env.dist bornhack/settings/.env
|
||||
|
||||
Run `make`
|
||||
Run `make` (removing USE_SQLITE=1 if you want to use postgres)
|
||||
|
||||
(venv) $ make
|
||||
(venv) $ SQLITE=1 make
|
||||
|
||||
Which is equivalent with this:
|
||||
|
||||
(venv) $ ./manage.py migrate --settings=bornhack.settings.development
|
||||
(venv) $ ./manage.py createsuperuser --settings=bornhack.settings.development
|
||||
(venv) $ ./manage.py runserver --settings=bornhack.settings.development
|
||||
|
||||
### Setting up Postgres
|
||||
|
||||
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.
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import os
|
||||
from .base import *
|
||||
|
||||
# INSTALLED_APPS += ['debug_toolbar', ]
|
||||
|
@ -5,6 +6,14 @@ from .base import *
|
|||
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',
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
DATABASE_URL=postgres://username:password@host:port/database
|
||||
SECRET_KEY=somethingverysecretandunique
|
||||
ALLOWED_HOSTS=localhost,127.0.0.1
|
||||
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'
|
||||
EPAY_MERCHANT_NUMBER=something
|
||||
EPAY_MD5_SECRET=something
|
||||
TICKET_CATEGORY_ID=''
|
||||
COINIFY_API_KEY=''
|
||||
COINIFY_API_SECRET=''
|
||||
COINIFY_IPN_SECRET=''
|
||||
PDF_LETTERHEAD_FILENAME=''
|
||||
MEDIA_ROOT=''
|
||||
BANKACCOUNT_IBAN=''
|
||||
BANKACCOUNT_SWIFTBIC=''
|
||||
BANKACCOUNT_REG=''
|
||||
BANKACCOUNT_ACCOUNT=''
|
||||
|
19
dev.sh
Executable file
19
dev.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Directory of this script
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
if ! [ -f "$DIR/bornhack/settings/.env" ]
|
||||
then
|
||||
echo "Creating .env file from template..."
|
||||
echo "MEDIA_ROOT=\"$DIR/.dev/media\"" > "$DIR/bornhack/settings/.env"
|
||||
cat "$DIR/.env_template" >> "$DIR/bornhack/settings/.env"
|
||||
fi
|
||||
|
||||
if ! [ -d "$DIR/.dev" ]
|
||||
then
|
||||
echo "Creating .dev dir for development stuff"
|
||||
mkdir -p "$DIR/.dev/media"
|
||||
fi
|
||||
|
||||
python "$DIR/manage.py" $@ --settings=bornhack.settings.development
|
|
@ -16,7 +16,7 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='coinifycallback',
|
||||
name='headers',
|
||||
field=django.contrib.postgres.fields.jsonb.JSONField(default=''),
|
||||
field=django.contrib.postgres.fields.jsonb.JSONField(default=None),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AddField(
|
||||
|
|
Loading…
Reference in a new issue