Move config object to config file
This commit is contained in:
parent
b7134dbc0f
commit
bb50382809
@ -12,11 +12,14 @@ Nur ein Mal zu initialisieren:
|
||||
git clone https://github.com/clerie/wetter.git
|
||||
cd wetter/
|
||||
virtualenv -p python3 ENV
|
||||
cp wetter/config/db.py.example wetter/config/db.py
|
||||
cd ..
|
||||
```
|
||||
|
||||
Passe nun `wetter/config/db.py` mit deinen Datenbankzugangsdaten an.
|
||||
Erstelle eine `config.cfg` mit folgendem Inhalt und passe die Werte entsprechend an.
|
||||
|
||||
```
|
||||
SQLALCHEMY_DATABASE_URI=postgresql://user:password@host:5432/database
|
||||
```
|
||||
|
||||
Bei Bedarf musst du noch die `wsgi.ini` anpassen.
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from wetter.config.db import db as config_db
|
||||
|
||||
from flask import Flask
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
import flask_excel as excel
|
||||
@ -10,7 +8,9 @@ app = Flask(__name__)
|
||||
excel.init_excel(app)
|
||||
|
||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||
app.config["SQLALCHEMY_DATABASE_URI"] = config_db['uri']
|
||||
|
||||
# override configs from file
|
||||
app.config.from_envvar('WETTER_SETTINGS')
|
||||
|
||||
db = SQLAlchemy(app)
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
db = {}
|
||||
db['uri'] = "postgresql://user:password@host:5432/database"
|
Loading…
Reference in New Issue
Block a user