mirror of
https://github.com/NovaOSS/nova-web.git
synced 2024-11-25 18:23:58 +01:00
66 lines
1.7 KiB
Python
Executable file
66 lines
1.7 KiB
Python
Executable file
import os
|
|
import flask
|
|
import secrets
|
|
import logging
|
|
|
|
from dotenv import load_dotenv
|
|
from werkzeug.middleware.proxy_fix import ProxyFix
|
|
|
|
load_dotenv()
|
|
|
|
log = logging.getLogger('werkzeug')
|
|
log.disabled = True
|
|
|
|
def create_app() -> flask.Flask:
|
|
app = flask.Flask(__name__)
|
|
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_prefix=1)
|
|
app.secret_key = os.environ['FLASK_SECRET_KEY']
|
|
app.jinja_env.trim_blocks = True
|
|
app.jinja_env.lstrip_blocks = True
|
|
|
|
import tos
|
|
import account
|
|
import finances
|
|
|
|
tos.register(app)
|
|
account.register(app)
|
|
finances.register(app)
|
|
|
|
# max file size 100 MB (cloudflare limit)
|
|
app.config['MAX_CONTENT_LENGTH'] = 100 * 1024 * 1024
|
|
|
|
@app.context_processor
|
|
def inject_variables():
|
|
return {
|
|
'contact_email': os.getenv('CONTACT_EMAIL')
|
|
}
|
|
|
|
@app.route('/')
|
|
def index():
|
|
return flask.render_template('index.html')
|
|
|
|
@app.route('/get-started')
|
|
def go():
|
|
return flask.render_template('get-started.html')
|
|
|
|
@app.route('/novacord')
|
|
def novacord_page():
|
|
return flask.render_template('novacord.html')
|
|
|
|
@app.route('/replit')
|
|
def replit_page():
|
|
return flask.render_template('replit.html')
|
|
|
|
@app.route('/favicon.ico')
|
|
def favicon():
|
|
return flask.send_file('static/img/fav.ico', mimetype='image/vnd.microsoft.icon')
|
|
|
|
return app
|
|
|
|
production = create_app()
|
|
|
|
if __name__ == '__main__':
|
|
PORT = int(os.environ.get('DEV_PORT', 2211))
|
|
print(f'* DEV environment online at http://localhost:{PORT}')
|
|
create_app().run(debug=True, use_reloader=True, use_evalex=False, port=PORT, host='0.0.0.0', threaded=True)
|