From d3202fc1e23d89aa4f49157b5589ed65eb639230 Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Mon, 28 Aug 2017 21:28:27 +0200 Subject: [PATCH 1/7] Change README to match src/ structure --- README.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 325c8d81..4f8861e3 100644 --- a/README.md +++ b/README.md @@ -35,30 +35,33 @@ Install system dependencies (method depends on OS): ### Python packages Install pip packages: ``` - (venv) $ pip install -r requirements.txt + (venv) $ pip install -r src/requirements.txt ``` ### Configuration file Copy environment settings file and change settings as needed: ``` - (venv) $ cp bornhack/environment_settings.py.dist bornhack/environment_settings.py + (venv) $ cp src/bornhack/environment_settings.py.dist src/bornhack/environment_settings.py ``` +Edit the configuration file, replacing all the ``{{ placeholder }}`` patterns +(intended for Ansible). + ### Database Is this a new installation? Initialize the database: ``` - (venv) $ ./manage.py migrate + (venv) $ src/manage.py migrate ``` Is this for local development? Bootstrap the database with dummy data and users: ``` - (venv) $ ./manage.py bootstrap-devsite + (venv) $ src/manage.py bootstrap-devsite ``` ### Done Is this for local development? Start the Django devserver: ``` - (venv) $ ./manage.py runserver + (venv) $ src/manage.py runserver ``` Otherwise start uwsgi or similar to serve the application. @@ -69,10 +72,10 @@ Enjoy! ### How to add a camp -Add a new camp in the admin interface and run ` +Add a new camp in the admin interface and run ``` - (venv) $ ./manage.py createcamp {camp-slug} + (venv) $ src/manage.py createcamp {camp-slug} ``` or go through the manuel process below: From 8c5d063b8b629fcaf7ffb5c48730f11e41c07e18 Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Mon, 28 Aug 2017 21:41:16 +0200 Subject: [PATCH 2/7] Add note about python3.. really annoying to forget --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4f8861e3..b32a88b3 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Clone with --recursive to include submodules: ### Virtualenv Create a Python 3 virtual environment and activate it: ``` -$ virtualenv venv +$ virtualenv venv -p python3 $ source venv/bin/activate ``` From ab18d46bfe04d29a840b5378741a5553138088bc Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Mon, 28 Aug 2017 21:53:38 +0200 Subject: [PATCH 3/7] Note about adding submodules after cloning --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index b32a88b3..a5efd056 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,9 @@ Clone with --recursive to include submodules: git clone --recursive https://github.com/bornhack/bornhack-website +If you already cloned the repository, you can add the submodules like this: + + git submodule update --init --recursive ### Virtualenv Create a Python 3 virtual environment and activate it: From ceef9bbd556474c0cd0bbe647a9482b7d35ae970 Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Mon, 28 Aug 2017 21:54:04 +0200 Subject: [PATCH 4/7] Calling manage outside of src/ --- src/manage.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/manage.py b/src/manage.py index fc2fdcda..1e3fe86b 100755 --- a/src/manage.py +++ b/src/manage.py @@ -2,6 +2,8 @@ import os import sys +sys.path.append(os.path.dirname(__file__)) + if __name__ == "__main__": os.environ.setdefault( "DJANGO_SETTINGS_MODULE", From a93a66b8ac38132e21b42b812debdcdd8525c62a Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Mon, 28 Aug 2017 21:56:38 +0200 Subject: [PATCH 5/7] Should set mapping to empty dict, not empty string asgi_layer = backend_class(**config) TypeError: type object argument after ** must be a mapping, not str --- src/bornhack/environment_settings.py.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bornhack/environment_settings.py.dist b/src/bornhack/environment_settings.py.dist index 07400c5b..4fced002 100644 --- a/src/bornhack/environment_settings.py.dist +++ b/src/bornhack/environment_settings.py.dist @@ -20,7 +20,7 @@ DEBUG={{ django_debug }} # the path to the wkhtmltopdf binary WKHTMLTOPDF_CMD="{{ wkhtmltopdf_path }}" -# set BACKEND to "asgiref.inmemory.ChannelLayer" and CONFIG to "" for local development +# set BACKEND to "asgiref.inmemory.ChannelLayer" and CONFIG to {} for local development CHANNEL_LAYERS = { "default": { "BACKEND": "{{ django_channels_backend }}", From bdf38b74079957550bfac6576f382f97c2e836e4 Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Mon, 28 Aug 2017 22:11:30 +0200 Subject: [PATCH 6/7] Adding a camp is mandatory, specify how to add it --- README.md | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index a5efd056..aa5b0337 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,27 @@ Is this for local development? Bootstrap the database with dummy data and users: (venv) $ src/manage.py bootstrap-devsite ``` +### Add a camp + +Add a new camp by running: + +``` + (venv) $ src/manage.py createcamp {camp-slug} +``` + +Then go to the admin interface to edit the camp details, adding the same slug +that you just used and some current dates. + +You can also specify details like: + +* A sponsors page, `{camp-slug}_sponsors.html`, to `sponsors/templates`. +* A frontpage, `{camp-slug}_camp_detail.html`, to `camps/templates`. +* A call for speakers page, `{camp-slug}_call_for_speakers.html`, to `program/templates`. +* A `static_src/img/{camp-slug}/logo` and add two logos: + * `{camp-slug}-logo-large.png` + * `{camp-slug}-logo-small.png` + + ### Done Is this for local development? Start the Django devserver: ``` @@ -73,23 +94,6 @@ Enjoy! ## Notes -### How to add a camp - -Add a new camp in the admin interface and run - -``` - (venv) $ src/manage.py createcamp {camp-slug} -``` -or go through the manuel process below: - -* Add a new camp in the admin interface. -* Add a sponsers page, `{camp-slug}_sponsors.html`, to `sponsors/templates`. -* Add a frontpage, `{camp-slug}_camp_detail.html`, to `camps/templates`. -* Add a call for speakers page, `{camp-slug}_call_for_speakers.html`, to `program/templates`. -* Create `static_src/img/{camp-slug}/logo` and add two logos: - * `{camp-slug}-logo-large.png` - * `{camp-slug}-logo-small.png` - ### multicamp prod migration notes * when villages.0008 migration fails go add camp_id to all existing villages From 2b4f8ed3f9d4af5d8e428fb36227b15fb30b698c Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Mon, 28 Aug 2017 22:29:38 +0200 Subject: [PATCH 7/7] Document the bootstrap-devsite command --- README.md | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index aa5b0337..0e2401db 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,27 @@ Is this for local development? Bootstrap the database with dummy data and users: (venv) $ src/manage.py bootstrap-devsite ``` +### Deploy camps+program test data + +Run this command to create a bunch of nice test data: + +``` + (venv) $ src/manage.py bootstrap-devsite +``` + + +### Done +Is this for local development? Start the Django devserver: +``` + (venv) $ src/manage.py runserver +``` + +Otherwise start uwsgi or similar to serve the application. + +Enjoy! + +## Notes + ### Add a camp Add a new camp by running: @@ -81,19 +102,6 @@ You can also specify details like: * `{camp-slug}-logo-large.png` * `{camp-slug}-logo-small.png` - -### Done -Is this for local development? Start the Django devserver: -``` - (venv) $ src/manage.py runserver -``` - -Otherwise start uwsgi or similar to serve the application. - -Enjoy! - -## Notes - ### multicamp prod migration notes * when villages.0008 migration fails go add camp_id to all existing villages