19 lines
672 B
Python
19 lines
672 B
Python
from flask import Flask
|
|
from app.routes import main
|
|
from flask_cors import CORS
|
|
import os
|
|
|
|
def create_app():
|
|
base_dir = os.path.abspath(os.path.dirname(__file__))
|
|
template_path = os.path.join(base_dir, '..', 'templates')
|
|
static_path = os.path.join(base_dir, '..','static')
|
|
app = Flask(__name__, template_folder=template_path, static_folder=static_path)
|
|
|
|
app.config['BASE_URL'] = os.environ.get('BASE_URL', 'http://192.168.91.101:5000')
|
|
@app.context_processor
|
|
def inject_config():
|
|
return dict(base_url=app.config['BASE_URL'])
|
|
|
|
CORS(app, resources={r"/api/*": {"origins": "*"}})
|
|
app.register_blueprint(main)
|
|
return app |