-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
37 lines (26 loc) · 1.07 KB
/
main.py
File metadata and controls
37 lines (26 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# ====================================================================
# CryptPaste
# The open-source Pastebin alternative
# Under the GPL v3 license
# ====================================================================
from flask import Flask, render_template, request,redirect, flash
import os
import shared
import db
app = Flask(__name__, template_folder="html", static_folder="static")
app.secret_key = os.urandom(24)
@app.route('/')
def index():
return render_template('index.html')
@app.context_processor
def context_processor():
return dict(config=shared.config_json["app"])
# load routes
from routes import view,api
app.register_blueprint(view.bp)
app.register_blueprint(api.bp)
# Recommend to run with Gunicorn
if shared.config_json["http"]["debug"]:
print("Hey, the debug server is not for production, use gunicorn instead")
print("Disable debug mode in the config.json")
app.run(host=shared.config_json["http"]["host"], port=shared.config_json["http"]["port"], debug=shared.config_json["http"]["debug"])