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/
|
.idea/
|
||||||
__pycache__/
|
__pycache__/
|
||||||
db.sqlite3
|
db.sqlite3
|
||||||
|
|
8
Makefile
8
Makefile
|
@ -3,15 +3,15 @@ SETTINGS = bornhack.settings.development
|
||||||
all: migrate superuser run
|
all: migrate superuser run
|
||||||
|
|
||||||
migrations:
|
migrations:
|
||||||
./manage.py makemigrations --settings=$(SETTINGS)
|
./dev.sh makemigrations --settings=$(SETTINGS)
|
||||||
|
|
||||||
migrate:
|
migrate:
|
||||||
./manage.py migrate --settings=$(SETTINGS)
|
./dev.sh migrate --settings=$(SETTINGS)
|
||||||
|
|
||||||
superuser:
|
superuser:
|
||||||
./manage.py createsuperuser --settings=$(SETTINGS)
|
./dev.sh createsuperuser --settings=$(SETTINGS)
|
||||||
|
|
||||||
run:
|
run:
|
||||||
./manage.py runserver --settings=$(SETTINGS)
|
./dev.sh runserver --settings=$(SETTINGS)
|
||||||
|
|
||||||
.PHONY = all migrations migrate superuser run
|
.PHONY = all migrations migrate superuser run
|
||||||
|
|
17
README.md
17
README.md
|
@ -10,8 +10,7 @@ Features do not include:
|
||||||
|
|
||||||
## Quickstart
|
## Quickstart
|
||||||
|
|
||||||
|
Create a Python 2.7 virtual environment and activate it:
|
||||||
Create a virtual environment and activate it:
|
|
||||||
|
|
||||||
$ virtualenv venv
|
$ virtualenv venv
|
||||||
$ source venv/bin/activate
|
$ 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
|
(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:
|
Which is equivalent with this:
|
||||||
|
|
||||||
(venv) $ ./manage.py migrate --settings=bornhack.settings.development
|
(venv) $ ./manage.py migrate --settings=bornhack.settings.development
|
||||||
(venv) $ ./manage.py createsuperuser --settings=bornhack.settings.development
|
(venv) $ ./manage.py createsuperuser --settings=bornhack.settings.development
|
||||||
(venv) $ ./manage.py runserver --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 *
|
from .base import *
|
||||||
|
|
||||||
# INSTALLED_APPS += ['debug_toolbar', ]
|
# INSTALLED_APPS += ['debug_toolbar', ]
|
||||||
|
@ -5,15 +6,23 @@ from .base import *
|
||||||
SECRET_KEY = 'bornhack_development'
|
SECRET_KEY = 'bornhack_development'
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
|
|
||||||
DATABASES = {
|
if os.environ.get('USE_SQLITE'):
|
||||||
'default': {
|
DATABASES = {
|
||||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
'default': {
|
||||||
'NAME': 'bornhack_dev',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'USER': 'bornhack',
|
'NAME': local_dir('../.dev/dev.db'),
|
||||||
'PASSWORD': 'bornhack',
|
}
|
||||||
'HOST': 'localhost',
|
}
|
||||||
'PORT': 5432,
|
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'
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||||
|
|
|
@ -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(
|
migrations.AddField(
|
||||||
model_name='coinifycallback',
|
model_name='coinifycallback',
|
||||||
name='headers',
|
name='headers',
|
||||||
field=django.contrib.postgres.fields.jsonb.JSONField(default=''),
|
field=django.contrib.postgres.fields.jsonb.JSONField(default=None),
|
||||||
preserve_default=False,
|
preserve_default=False,
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
|
|
Loading…
Reference in a new issue