コード例 #1
0
app.config["DB_DATABASE"] = "gino"
app.config["DB_USER"] = "******"
app.config["DB_PASSWORD"] = "******"

# set os.environ["ADMIN_AUTH_DISABLE"] = "1" to disable auth
db.init_app(app)


@app.route("/")
async def index(request):
    return response.redirect("/admin")


current_path = os.path.dirname(os.path.abspath(__file__))

add_admin_panel(
    app,
    db,
    [Place, City, Camp, Education, Address, Country],
    composite_csv_settings={
        "area": {
            "models": (Place, Education, Camp),
            "type_column": "type"
        }
    },
    presets_folder=os.path.join(current_path, "csv_to_upload"),
)

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=os.getenv("PORT", 5000), debug=True)
コード例 #2
0
app.config["ADMIN_USER"] = "******"
app.config["ADMIN_PASSWORD"] = "******"

app.config["DB_HOST"] = os.environ.get("DB_HOST", "localhost")
app.config["DB_DATABASE"] = "gino"
app.config["DB_USER"] = "******"
app.config["DB_PASSWORD"] = "******"

db.init_app(app)


@app.route("/")
async def index(request):
    return response.redirect("/admin")


current_path = os.path.dirname(os.path.abspath(__file__))

add_admin_panel(
    app,
    db,
    [User, Place, City, GiftCard, Country, Item],
    # any Gino Admin Config params
    presets_folder=os.path.join(current_path, "csv_to_upload"),
    name="Demo Gino Admin Panel",
    route="/gino_admin_demo",
)

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=os.getenv("PORT", 5000), debug=True)
コード例 #3
0
ファイル: app.py プロジェクト: xnuinside/gino-admin
@app.route("/")
async def index(request):
    return response.redirect("/admin")


@app.route("/ui")
async def ui_test(request):
    return jinja.render("index.html", request)


# custom_hash_method you can define your own hash method to use it in backend and Admin
def custom_hash_method(*args, **kwargs):
    print("My custom hash method! Must return python callable object")
    return pbkdf2_sha256.hash(*args, **kwargs)


current_path = os.path.dirname(os.path.abspath(__file__))

add_admin_panel(
    app,
    db,
    [User, Place, City, GiftCard, Country, Item],
    # any Gino Admin Config params
    hash_method=custom_hash_method,
    presets_folder=os.path.join(current_path, "csv_to_upload"),
    name="Base Example",
    hide_columns=["id", Place.hide_column_sample],
)
if __name__ == "__main__":
    app.run(host="0.0.0.0", port=os.getenv("PORT", 5000), debug=True)