diff options
Diffstat (limited to 'halfnarp2.py')
| -rwxr-xr-x | halfnarp2.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/halfnarp2.py b/halfnarp2.py index ebd6f6b..5451411 100755 --- a/halfnarp2.py +++ b/halfnarp2.py | |||
| @@ -12,15 +12,6 @@ import markdown | |||
| 12 | from html_sanitizer import Sanitizer | 12 | from html_sanitizer import Sanitizer |
| 13 | from hashlib import sha256 | 13 | from hashlib import sha256 |
| 14 | 14 | ||
| 15 | app = Flask(__name__) | ||
| 16 | app.config["SQLALCHEMY_DATABASE_URI"] = "postgresql://halfnarp@localhost:5432/halfnarp" | ||
| 17 | app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False | ||
| 18 | app.config["SERVER_NAME"] = "halfnarp.events.ccc.de" | ||
| 19 | app.config["SECRET_KEY"] = "<YOUR SERVER SECRET HERE>" | ||
| 20 | app.jinja_env.trim_blocks = True | ||
| 21 | app.jinja_env.lstrip_blocks = True | ||
| 22 | CORS(app) | ||
| 23 | |||
| 24 | db = SQLAlchemy(app) | 15 | db = SQLAlchemy(app) |
| 25 | 16 | ||
| 26 | 17 | ||
| @@ -276,6 +267,19 @@ if __name__ == "__main__": | |||
| 276 | config["pretalx-url"] + "api/events/" + config["pretalx-conference"] | 267 | config["pretalx-url"] + "api/events/" + config["pretalx-conference"] |
| 277 | ) | 268 | ) |
| 278 | 269 | ||
| 270 | app = Flask(__name__) | ||
| 271 | app.config["SQLALCHEMY_DATABASE_URI"] = config.get( | ||
| 272 | "database-uri", "sqlite:///test.db" | ||
| 273 | ) | ||
| 274 | app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False | ||
| 275 | app.config["SERVER_NAME"] = config.get("server-name", "localhost") | ||
| 276 | app.config["SECRET_KEY"] = "<YOUR SERVER SECRET HERE>" | ||
| 277 | app.jinja_env.trim_blocks = True | ||
| 278 | app.jinja_env.lstrip_blocks = True | ||
| 279 | CORS() | ||
| 280 | |||
| 281 | db.init(app) | ||
| 282 | |||
| 279 | with app.app_context(): | 283 | with app.app_context(): |
| 280 | db.create_all() | 284 | db.create_all() |
| 281 | if args.pretalx_import: | 285 | if args.pretalx_import: |
