diff --git a/flask/forest/config.py b/flask/forest/config.py index 56ba102..40f4630 100644 --- a/flask/forest/config.py +++ b/flask/forest/config.py @@ -9,3 +9,4 @@ class Config(object): SQLALCHEMY_TRACK_MODIFICATIONS = False STATIC_FOLDER = f"{os.getenv('APP_FOLDER')}/forest/static" MEDIA_FOLDER = f"{os.getenv('APP_FOLDER')}/forest/media" + ADMIN_PREFIX = "fadmin" diff --git a/flask/forest/init.py b/flask/forest/init.py deleted file mode 100644 index e3f93bf..0000000 --- a/flask/forest/init.py +++ /dev/null @@ -1,57 +0,0 @@ -import os - -from werkzeug.utils import secure_filename -from flask import ( - Flask, - jsonify, - send_from_directory, - request, - redirect, - url_for -) -from flask_sqlalchemy import SQLAlchemy - -app = Flask(__name__) -app.config.from_object("project.config.Config") -db = SQLAlchemy(app) - - -class User(db.Model): - __tablename__ = "users" - - id = db.Column(db.Integer, primary_key=True) - email = db.Column(db.String(128), unique=True, nullable=False) - active = db.Column(db.Boolean(), default=True, nullable=False) - - def __init__(self, email): - self.email = email - - -@app.route("/") -def hello_world(): - return jsonify(hello="world") - - -@app.route("/static/") -def staticfiles(filename): - return send_from_directory(app.config["STATIC_FOLDER"], filename) - - -@app.route("/media/") -def mediafiles(filename): - return send_from_directory(app.config["MEDIA_FOLDER"], filename) - - -@app.route("/upload", methods=["GET", "POST"]) -def upload_file(): - if request.method == "POST": - file = request.files["file"] - filename = secure_filename(file.filename) - file.save(os.path.join(app.config["MEDIA_FOLDER"], filename)) - return """ - - upload new File -
-

-

- """