1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-23 05:24:18 +00:00
pds-2021-g2-nest/code/backend/nest_backend/__main__.py
2021-05-07 19:46:14 +02:00

23 lines
718 B
Python

"""
This is the runner for the server.
"""
import os
import sys
from .gestione import *
from .app import app, extension_sqlalchemy
print(" * Swagger docs will be available at http://127.0.0.1:5000/docs")
with app.app_context():
print(" * Creating database tables...")
extension_sqlalchemy.create_all(app=app)
if not User.query.filter_by(isAdmin=True).all():
print(" * Creating default admin account...")
extension_sqlalchemy.session.add(
User(email="admin@admin.com", password=gen_password("password"), username="admin", isAdmin=True))
extension_sqlalchemy.session.commit()
print(" * Created! Username: admin | Password: password")
app.run(debug=__debug__)