diff --git a/README.md b/README.md index b526158..35679df 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,67 @@ -# Database +# Goslar Event Prototype +Website prototype using Python, Flask and Postgres running on Heroku. + +## Setup + +### Environment variables + +Create `.env` file in the root directory and define the following variables: + +``` +DATABASE_URL= +GOOGLE_OAUTH_CLIENT_ID= +GOOGLE_OAUTH_CLIENT_SECRET= +OAUTHLIB_INSECURE_TRANSPORT=true +OAUTHLIB_RELAX_TOKEN_SCOPE=true +GOOGLE_MAPS_API_KEY= +``` + +## Development + +### Database + +``` python manage.py db init python manage.py db migrate python manage.py db upgrade +``` -## Development only +#### Local development only +``` python manage.py db history python manage.py db downgrade // reset git: migrations/versions python manage.py db migrate python manage.py db upgrade +``` -## Kill local detached server +### Kill local detached server +``` lsof -i :5000 kill -9 PIDNUMBER +``` -## i18n +### i18n -## Init +#### Init +``` pybabel extract -F babel.cfg -o messages.pot . && pybabel extract -F babel.cfg -k lazy_gettext -o messages.pot . && pybabel init -i messages.pot -d translations -l de +``` -## Neue msgid's scannen und in *.po mergen +#### Neue msgid's scannen und in *.po mergen +``` pybabel extract -F babel.cfg -o messages.pot . && pybabel extract -F babel.cfg -k lazy_gettext -o messages.pot . && pybabel update -i messages.pot -d translations +``` -## Nach dem Übersetzen +#### Nach dem Übersetzen +``` pybabel compile -d translations +``` diff --git a/app.py b/app.py index 1a7c902..6184792 100644 --- a/app.py +++ b/app.py @@ -94,6 +94,11 @@ def get_localized_enum_name(enum): app.jinja_env.filters['loc_enum'] = lambda u: get_localized_enum_name(u) +def env_override(value, key): + return os.getenv(key, value) + +app.jinja_env.filters['env_override'] = env_override + def print_dynamic_texts(): gettext('Event_Art') gettext('Event_Book') diff --git a/runlocal.sh b/runlocal.sh index ba63400..2420e4e 100755 --- a/runlocal.sh +++ b/runlocal.sh @@ -1,3 +1,4 @@ export DATABASE_URL="postgresql://daniel@localhost/gsevpt" +export GOOGLE_MAPS_API_KEY="***REMOVED***" #pip install -r requirements.txt flask run --host 0.0.0.0 \ No newline at end of file diff --git a/templates/_macros.html b/templates/_macros.html index 2da465c..9f18b6a 100644 --- a/templates/_macros.html +++ b/templates/_macros.html @@ -406,7 +406,7 @@ {% endmacro %} {% macro render_google_place_autocomplete_header(location_only = False) %} - +