64 lines
1.7 KiB
Markdown
64 lines
1.7 KiB
Markdown
# eFundBüro
|
|
|
|
## How to install
|
|
|
|
- clone repository
|
|
- Tested with python version 3.6
|
|
- create virtualenv and `pip install -r requirements.txt`
|
|
- Run `python manage.py makemigrations`
|
|
- create db with `python manage.py migrate`
|
|
- create superuser with `python manage.py createsuperuser`
|
|
- import catalog from xlsx `python manage.py import_catalog ~/ownCloud/Project_eFundbuero/Datenbank-Zeugs/Fundbüro\ Muster\ Export\ aus\ MuseumPlus.xlsx`
|
|
|
|
## Sample uwsgi config file
|
|
|
|
```
|
|
[uwsgi]
|
|
socket = /home/app/app/uwsgi.sock
|
|
chdir = /home/app/app
|
|
venv = /home/app/pyvenv
|
|
wsgi-file = efundburo/wsgi.py
|
|
processes = 4
|
|
threads = 2
|
|
chmod-socket = 666
|
|
vacuum = true
|
|
plugins = python3
|
|
uid = app
|
|
gid = app
|
|
env = DJANGO_SETTINGS_MODULE=efundburo.production
|
|
env = DEBUG=True
|
|
wsgi-disable-file-wrapper = true
|
|
```
|
|
|
|
## Production setup
|
|
|
|
### Endpoints
|
|
|
|
#### API
|
|
|
|
* `GET /search/?query={keyword}` allow to retreive item matching the keyword in the
|
|
item title, description or inventory_number.
|
|
* `GET /item/{item_pk}/` return the details of an item
|
|
* `GET /item/{item_pk}/comments/` return the validated comments of an item.
|
|
* `POST /item/{item_pk}/comments/` allow you to create a new comment. The endpoint
|
|
expect a JSON dict with the following keys :
|
|
* `comment`: the content of the comment as a string
|
|
* `author`: the author of the comment as a string
|
|
* *optional* `field_specific`: the field to comment on. Can be any of the
|
|
field of the Item model
|
|
|
|
### Application
|
|
|
|
Application is running as `efundbuero` user in `/home/efundbuero/efundbuero`. To deploy:
|
|
|
|
```
|
|
# SSH to server
|
|
sudo su - efundbuero
|
|
workon efundbuero
|
|
cd efundbuero
|
|
git pull
|
|
# Run migrations, collect staticfiles etc if needed
|
|
exit
|
|
sudo systemctl restart apache2
|
|
```
|