Merge pull request #269 from benjaoming/readmeupdates

Add a development default settings file and modify instructions
This commit is contained in:
Víðir Valberg Guðmundsson 2018-08-18 16:04:35 +02:00 committed by GitHub
commit 313ac788a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 98 additions and 11 deletions

View file

@ -2,7 +2,7 @@
Django project to power Bornhack. Features include news, villages, webshop, and more. Django project to power Bornhack. Features include news, villages, webshop, and more.
## Setup ## Development setup
### Clone the repo ### Clone the repo
Clone with --recursive to include submodules: Clone with --recursive to include submodules:
@ -38,27 +38,36 @@ Install system dependencies (method depends on OS):
### Python packages ### Python packages
Install pip packages: Install pip packages:
``` ```
(venv) $ pip install -r src/requirements/dev.txt (venv) $ pip install -r src/requirements/dev.txt
``` ```
### Postgres
You need to have a running Postgres instance (we use Postgres-specific datetime range fields). Install Postgress, and add a database `bornhack` (or whichever you like) with some way for the application to connect to it, for instance adding a user with a password.
You can also use Unix socket connections if you know how to. It's faster, easier and perhaps more secure.
### Configuration file ### Configuration file
Copy environment settings file and change settings as needed:
Copy dev environment settings file and change settings as needed:
``` ```
(venv) $ cp src/bornhack/environment_settings.py.dist src/bornhack/environment_settings.py (venv) $ cp src/bornhack/environment_settings.py.dist.dev src/bornhack/environment_settings.py
``` ```
Edit the configuration file, replacing all the ``{{ placeholder }}`` patterns Edit the configuration file, setting up `DATABASES` matching your Postgres settings.
(intended for Ansible).
### Database ### Database
Is this a new installation? Initialize the database: Is this a new installation? Initialize the database:
``` ```
(venv) $ src/manage.py migrate (venv) $ src/manage.py migrate
``` ```
Is this for local development? Bootstrap the database with dummy data and users: Is this for local development? Bootstrap the database with dummy data and users:
``` ```
(venv) $ src/manage.py bootstrap-devsite (venv) $ src/manage.py bootstrap-devsite
``` ```
### Deploy camps+program test data ### Deploy camps+program test data
@ -66,14 +75,14 @@ Is this for local development? Bootstrap the database with dummy data and users:
Run this command to create a bunch of nice test data: Run this command to create a bunch of nice test data:
``` ```
(venv) $ src/manage.py bootstrap-devsite (venv) $ src/manage.py bootstrap-devsite
``` ```
### Done ### Done
Is this for local development? Start the Django devserver: Is this for local development? Start the Django devserver:
``` ```
(venv) $ src/manage.py runserver (venv) $ src/manage.py runserver
``` ```
Otherwise start uwsgi or similar to serve the application. Otherwise start uwsgi or similar to serve the application.
@ -87,7 +96,7 @@ Enjoy!
Add a new camp by running: Add a new camp by running:
``` ```
(venv) $ src/manage.py createcamp {camp-slug} (venv) $ src/manage.py createcamp {camp-slug}
``` ```
Then go to the admin interface to edit the camp details, adding the same slug Then go to the admin interface to edit the camp details, adding the same slug

View file

@ -0,0 +1,78 @@
import os
# MODIFY THIS!
#
# If you worry about loosing your local development database secrets,
# then change this for something less well-known. You can use lots of
# characters!
SECRET_KEY = "something-very-random"
ALLOWED_HOSTS = "*"
# MODIFY THIS!
#
# Database settings - modify to match your database configuration!
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": "bornhack",
"USER": "bornhack",
# Comment back in if you are connecting via TCP
# "PASSWORD": "bornhack",
# "HOST": "localhost",
}
}
DEBUG = True
WKHTMLTOPDF_CMD = "wkhtmltopdf"
CHANNEL_LAYERS = {}
ASGI_APPLICATION = "bornhack.routing.application"
CAMP_REDIRECT_PERCENT = 40
MEDIA_ROOT = os.path.join(
os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "media"
)
# schedule settings
SCHEDULE_MIDNIGHT_OFFSET_HOURS = 9
SCHEDULE_TIMESLOT_LENGTH_MINUTES = 30
SCHEDULE_EVENT_NOTIFICATION_MINUTES = 10
PDF_LETTERHEAD_FILENAME = "bornhack-2017_test_letterhead.pdf"
PDF_ARCHIVE_PATH = os.path.join(MEDIA_ROOT, "pdf_archive")
SENDFILE_ROOT = MEDIA_ROOT + "/protected"
SENDFILE_URL = "/protected"
SENDFILE_BACKEND = "sendfile.backends.development"
IRCBOT_CHECK_MESSAGE_INTERVAL_SECONDS = 10
IRCBOT_NICK = "humankillerbot"
IRCBOT_NICKSERV_PASSWORD = ""
IRCBOT_SERVER_HOSTNAME = ""
IRCBOT_SERVER_PORT = 6697
IRCBOT_SERVER_USETLS = True
IRCBOT_CHANNELS = {
"default": "#my-bornhack-channel",
"orga": "#my-bornhack-channel",
"public": "#my-bornhack-channel",
}
IRCBOT_PUBLIC_CHANNEL = "#my-bornhack-channel"
IRCBOT_VOLUNTEER_CHANNEL = "#my-bornhack-channel"
BANKACCOUNT_IBAN = "LOL"
BANKACCOUNT_SWIFTBIC = "lol"
BANKACCOUNT_REG = "lol"
BANKACCOUNT_ACCOUNT = "lol"
BANKACCOUNT_BANK = "lol"
TIME_ZONE = "Europe/Copenhagen"
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
ARCHIVE_EMAIL = "archive@example.com"
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels.layers.InMemoryChannelLayer",
},
}