1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-28 15:34:20 +00:00
pds-2021-g2-nest/nest_backend/__main__.py

25 lines
879 B
Python

"""
This is the runner for the server.
"""
import os
import sys
from .gestione import *
from .app import app, extension_sqlalchemy
from .database import User
print(" * N.E.S.T. Server is now starting. Please hold up.")
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")
print(" * N.E.S.T. is based on Gestione and coded by the N.E.S.T. team.")
app.run(debug=__debug__)