-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.py
45 lines (40 loc) · 1.54 KB
/
app.py
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
38
39
40
41
42
43
44
45
from flask import Flask, render_template, request, redirect, url_for, session, flash, jsonify
from flask_sqlalchemy import SQLAlchemy
import os
import random
import sys
from database import db_session
import json
from werkzeug.utils import secure_filename
from config import Config
from datetime import datetime
app = Flask(__name__)
try:
try:
if os.environ['FLASK_ENV'] == "development":
import settings
app.config['APP_SETTINGS'] = settings.APP_SETTINGS
app.secret_key = settings.SECRET_KEY
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = settings.SQLALCHEMY_TRACK_MODIFICATIONS
app.config['SQLALCHEMY_DATABASE_URI'] = settings.DATABASE_URL
except:
app.config['APP_SETTINGS'] = os.environ['APP_SETTINGS']
app.secret_key = os.environ['SECRET_KEY']
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = os.environ['SQLALCHEMY_TRACK_MODIFICATIONS']
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL']
except:
import settings
app.config['APP_SETTINGS'] = settings.APP_SETTINGS
app.secret_key = settings.SECRET_KEY
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = settings.SQLALCHEMY_TRACK_MODIFICATIONS
app.config['SQLALCHEMY_DATABASE_URI'] = settings.DATABASE_URL
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
db = SQLAlchemy(app)
migrate = Migrate(app, db)
from models import Participant
@app.route('/', methods=["GET", "POST"])
def html_page():
return "Hello World"
if __name__ == '__main__':
app.run()