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.
## Setup
## Development setup
### Clone the repo
Clone with --recursive to include submodules:
@ -41,22 +41,31 @@ Install pip packages:
(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
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
(intended for Ansible).
Edit the configuration file, setting up `DATABASES` matching your Postgres settings.
### Database
Is this a new installation? Initialize the database:
```
(venv) $ src/manage.py migrate
```
Is this for local development? Bootstrap the database with dummy data and users:
```
(venv) $ src/manage.py bootstrap-devsite
```

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",
},
}