You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
from flask import Flask
|
|
|
|
from flask_admin.contrib.mongoengine import ModelView
|
|
|
|
from mongoengine import connect
|
|
|
|
|
|
|
|
from models.Union import Union
|
|
|
|
from models.User import User
|
|
|
|
from restapi import MongoApi
|
|
|
|
from flask_admin import Admin
|
|
|
|
"""
|
|
|
|
Mongodb connection string
|
|
|
|
"""
|
|
|
|
connect('adunatio', host='mongo',username="xcoder",password="4dun4710", authentication_source='admin')
|
|
|
|
|
|
|
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
app.secret_key = "secret_key+secret_key"
|
|
|
|
api = MongoApi(app)
|
|
|
|
api.register_model(User,uri="/api/user")
|
|
|
|
adm = Admin(app)
|
|
|
|
adm.add_view(ModelView(User))
|
|
|
|
adm.add_view(ModelView(Union))
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
app.run(host="0.0.0.0",port=5000,debug=True)
|