2016-12-09 05:11:31 +00:00
|
|
|
Public Health Schweiz
|
|
|
|
=====================
|
|
|
|
|
2016-12-12 22:43:20 +00:00
|
|
|
Website of the Swiss Society for Public Health
|
|
|
|
|
|
|
|
## Development environment
|
|
|
|
|
2016-12-14 09:43:06 +00:00
|
|
|
The easiest way to set up your machine would be to use [Vagrant](https://vagrantup.com), then in the project folder in the terminal type:
|
|
|
|
|
|
|
|
```
|
|
|
|
vagrant liverun
|
|
|
|
```
|
|
|
|
|
|
|
|
**Backend setup**
|
|
|
|
|
|
|
|
After installing Python 3, from the project folder:
|
2016-12-12 22:43:20 +00:00
|
|
|
|
|
|
|
```
|
2016-12-19 10:32:58 +00:00
|
|
|
sudo apt-get install python3-venv python3-dev libjpeg-dev
|
2016-12-09 05:11:31 +00:00
|
|
|
pyvenv env
|
|
|
|
. env/bin/activate
|
2016-12-09 05:54:14 +00:00
|
|
|
|
2016-12-09 05:11:31 +00:00
|
|
|
pip install -U pip
|
|
|
|
pip install -r requirements.txt
|
2016-12-09 05:54:14 +00:00
|
|
|
|
|
|
|
./manage.py migrate
|
|
|
|
./manage.py createsuperuser
|
2016-12-12 22:43:20 +00:00
|
|
|
```
|
2016-12-12 22:44:06 +00:00
|
|
|
|
2016-12-14 09:43:06 +00:00
|
|
|
You will be asked a few questions to create an administrator account.
|
|
|
|
|
|
|
|
**Frontend setup**
|
|
|
|
|
|
|
|
Make sure a recent version of node.js is installed, then:
|
2016-12-12 22:44:06 +00:00
|
|
|
|
|
|
|
```
|
2016-12-19 10:32:58 +00:00
|
|
|
npm install -g bower grunt-cli
|
2016-12-12 22:44:06 +00:00
|
|
|
npm install
|
|
|
|
bower install
|
2016-12-14 09:43:06 +00:00
|
|
|
```
|
|
|
|
|
2017-01-10 15:56:45 +00:00
|
|
|
If you have one installed, also start your local redis server (`service redis start`).
|
|
|
|
|
2016-12-14 09:43:06 +00:00
|
|
|
**Starting up**
|
|
|
|
|
|
|
|
Run this after completing setup:
|
|
|
|
|
|
|
|
```
|
2017-01-10 15:56:45 +00:00
|
|
|
./manage.py runserver &
|
2016-12-12 22:44:06 +00:00
|
|
|
grunt browser-sync
|
|
|
|
```
|
2016-12-14 09:43:06 +00:00
|
|
|
|
2017-01-10 15:56:45 +00:00
|
|
|
A default browser should open pointing to the default home page.
|
|
|
|
|
|
|
|
Now access the admin panel with the user account you created earlier: http://localhost:3000/admin/
|
2017-03-03 17:13:31 +00:00
|
|
|
|
|
|
|
## Troubleshooting
|
|
|
|
|
|
|
|
- Issues with migrating database tables in SQLite during development? Try `./manage.py migrate --fake`
|
2017-03-27 21:32:32 +00:00
|
|
|
|
|
|
|
## Production notes
|
|
|
|
|
2017-04-08 12:32:52 +00:00
|
|
|
We suggest using Docker or [Dokku](http://dokku.viewdocs.io/) for automated deployment. There is a Makefile to help set up and manage the instance.
|
2017-03-27 21:32:32 +00:00
|
|
|
|
2017-04-08 12:32:52 +00:00
|
|
|
- Initial setup: `make setup`
|
|
|
|
- Startup: `make run-detached`
|
|
|
|
- Release: `make release`
|