Skip to content

The (django) webapp for the scenario-explorer of the "Stadt-Land-Energie" project.

License

Unknown, GPL-3.0 licenses found

Licenses found

Unknown
LICENSE
GPL-3.0
COPYING
Notifications You must be signed in to change notification settings

stadt-land-energie-projekt/sl-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stadt-Land-Energie Webapp

The (django) webapp for the scenario-explorer of the "Stadt-Land-Energie" project.

Built with Cookiecutter Django Black code style

License: GPLv3

Settings

Moved to settings.

Basic Commands

Setting Up Your Users

  • To create a normal user account, just go to Sign Up and fill out the form. Once you submit it, you'll see a "Verify Your E-mail Address" page. Go to your console to see a simulated email verification message. Copy the link into your browser. Now the user's email should be verified and ready to go.

  • To create a superuser account, use this command:

    $ python manage.py createsuperuser
    

For convenience, you can keep your normal user logged in on Chrome and your superuser logged in on Firefox (or similar), so that you can see how the site behaves for both kinds of users.

Celery

This app comes with Celery.

To run a celery worker:

cd slapp
celery -A config.celery_app worker -l info

Please note: For Celery's import magic to work, it is important where the celery commands are run. If you are in the same folder with manage.py, you should be right.

To run periodic tasks, you'll need to start the celery beat scheduler service. You can start it as a standalone process:

cd slapp
celery -A config.celery_app beat

or you can embed the beat service inside a worker with the -B option (not recommended for production use):

cd slapp
celery -A config.celery_app worker -B -l info

Sentry

Sentry is an error logging aggregator service. You can sign up for a free account at https://sentry.io/signup/?code=cookiecutter or download and host it yourself. The system is set up with reasonable defaults, including 404 logging and integration with the WSGI application.

You must set the DSN url in production.

Load data into application

First you have to set up all tables in the database by runnning:

python manage.py migrate

Afterwards you have to load in data. To simplify data commands a Makefile has been added, which can be used by command make. You can load all data by running (or you can run them one-by-one):

make load_regions load_data

And you can empty all data by running:

make empty_data empty_regions

Deployment

This application is ready to be deployed via Caprover. Make sure to define the following Environmental Variables:

REDIS_URL= DATABASE_URL=postgis:// DJANGO_DEBUG=False DJANGO_SETTINGS_MODULE=config.settings.production DJANGO_SECRET_KEY= DJANGO_ADMIN_URL= DJANGO_ALLOWED_HOSTS= DJANGO_ACCOUNT_ALLOW_REGISTRATION=True SENTRY_DSN= POSTGRES_HOST= POSTGRES_PORT= POSTGRES_DB= POSTGRES_USER= POSTGRES_PASSWORD= STARTUP_COMMAND=/start CELERY_BROKER_URL=redis:// MAP_ENGINE_TILING_SERVICE_TOKEN= MAP_ENGINE_TILING_SERVICE_STYLE_ID= MAP_ENGINE_USE_DISTILLED_MVTS=

To upload new data, its is probably the easiest to make them work locally, create a backup and use that backup on the target postgres/gis:

  • create a backup of the local DB: pg_dump -Fc db_name > db_name.tar
  • restore DB to remote server: pg_restore -h server_url -p server_url -d remote_db_name -U remote_db_name -c db_name.tar

Docker

See detailed cookiecutter-django Docker documentation.

About

The (django) webapp for the scenario-explorer of the "Stadt-Land-Energie" project.

Resources

License

Unknown, GPL-3.0 licenses found

Licenses found

Unknown
LICENSE
GPL-3.0
COPYING

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published