# foerderbarometer purpose: gather data from intern(WMDE) and extern(volunteers) forms to create a database ('förderdatenbank') and send emails with links for a questionary. ## manual development setup cp .env.develop.example .env By default a SQLite database is used for development. To use a MariaDB change `DATABASE_ENGINE` in .env to `mysql` and amend `DATABASE_*` variables according to your setup. For further information see the production setup below. build the database with python3 manage.py migrate create superuser account with python3 manage.py createsuperuser run the development server with python3 manage.py runserver access via http://localhost:8000/ http://localhost:8000/admin/ (login reqiured) ## docker compose development setup The project comes with a `docker-compose.yml` file to run the project in a containerized environment. cp .env.develop.example .env docker compose up The setup will use a containerized MariaDB database. Create your superuser account with docker compose exec django python3 manage.py createsuperuser You can access the application via http://localhost:8000/ http://localhost:8000/admin/ (login required) ## additional admin functionality The admin page is the standard admin page delivered by django but with two additional functionalities: - There is a new action "export to csv" with which you can export all Selected entries to a csv file - There is a new button in the bottom of every Project to "save as new" ## mail attachments For all mails, attachments can be defined as URLs. These URLs are fetched and chached when sending the mail and attached to the mail. Configuration is done via the `ATTACHMENT_URLS` setting. Attachments can be set for user (`RECIPIENT_APPLICANT`) and staff (`RECIPIENT_STAFF`) mails. The following mail types exist: * `TYPE_BIB` Bibliotheksstipendium * `TYPE_ELIT` eLiteraturstipendium * `TYPE_SOFT` Softwarestipendium * `TYPE_MAIL` E-Mail-Adresse * `TYPE_IFG` Kostenübernahme IFG-Anfrage * `TYPE_LIT` Literaturstipendium * `TYPE_LIST` Mailingliste * `TYPE_TRAV` Reisekosten * `TYPE_VIS` Visitenkarten * `TYPE_PROJ` Projektförderung For further details see `foerderbarometer/settings.py` ## testing run some tests with python3 manage.py test ## production setup cp .env.production.example .env edit .env and fill in the missing secrets SECRET_KEY DATABASE_PASSWORD EMAIL_HOST_USER EMAIL_HOST_PASSWORD OAUTH_CLIENT_NAME OAUTH_CLIENT_ID OAUTH_CLIENT_SECRET amend database variables to .env according to your database setup (tested with MariaDB 10.0.36), e.g. DATABASE_NAME DATABASE_USER DATABASE_HOST DATABASE_PORT for a full set of all possible env vars have a look at foerderbarometer/settings.py run the following commands: python3 manage.py migrate python3 manage.py collectstatic server starts with nohup gunicorn --forwarded-allow-ips="*" -b '0:8000' foerderbarometer.wsgi 2&> logfile & Should be executed at least daily e.g. in crontab python3 manage.py sendmails