mirror of
https://github.com/lucaspalomodevelop/eventcally.git
synced 2026-03-13 00:07:22 +00:00
Google Maps API Key in Env-Variable ausgelagert
This commit is contained in:
parent
89a0696d5a
commit
ff325faf73
47
README.md
47
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
|
||||
|
||||
<https://pythonhosted.org/Flask-BabelEx/>
|
||||
|
||||
## 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
|
||||
```
|
||||
|
||||
5
app.py
5
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')
|
||||
|
||||
@ -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
|
||||
@ -406,7 +406,7 @@
|
||||
{% endmacro %}
|
||||
|
||||
{% macro render_google_place_autocomplete_header(location_only = False) %}
|
||||
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=***REMOVED***&libraries=places"></script>
|
||||
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key={{ "dev" | env_override('GOOGLE_MAPS_API_KEY') }}&libraries=places"></script>
|
||||
<script>
|
||||
function initialize() {
|
||||
var input = document.getElementById('location_search');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user