Initial commit of our brand new photo assistant
This commit is contained in:
36
main.py
Normal file
36
main.py
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
from flask import Flask, render_template, request, redirect, jsonify
|
||||||
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
|
from sqlalchemy.exc import SQLAlchemyError
|
||||||
|
from flask_marshmallow import Marshmallow
|
||||||
|
from flask_bootstrap import Bootstrap
|
||||||
|
from wtforms import SubmitField, StringField, HiddenField, SelectField, IntegerField, TextAreaField, validators
|
||||||
|
from flask_wtf import FlaskForm
|
||||||
|
from status import st, Status
|
||||||
|
import re
|
||||||
|
import socket
|
||||||
|
|
||||||
|
####################################### Flask App globals #######################################
|
||||||
|
DEV_HOST="mara"
|
||||||
|
hostname = socket.gethostname()
|
||||||
|
print( "Running on: {}".format( hostname) )
|
||||||
|
app = Flask(__name__)
|
||||||
|
### what is this value? I gather I should chagne it?
|
||||||
|
|
||||||
|
# local DB conn string
|
||||||
|
if hostname == DEV_HOST:
|
||||||
|
DB_URL = 'postgresql+psycopg2://ddp:NWNlfa01@127.0.0.1:5432/library'
|
||||||
|
else:
|
||||||
|
DB_URL = 'postgresql+psycopg2://ddp:blahdeblah@bookdb:5432/library'
|
||||||
|
|
||||||
|
app.config['SQLALCHEMY_DATABASE_URI'] = DB_URL
|
||||||
|
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||||
|
app.config.from_mapping( SECRET_KEY=b'\xd6\x04\xbdj\xfe\xed$c\x1e@\xad\x0f\x13,@G')
|
||||||
|
db = SQLAlchemy(app)
|
||||||
|
ma = Marshmallow(app)
|
||||||
|
Bootstrap(app)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if hostname == DEV_HOST:
|
||||||
|
app.run(host="0.0.0.0", debug=True)
|
||||||
|
else:
|
||||||
|
app.run(ssl_context=('/etc/letsencrypt/live/book.depaoli.id.au/cert.pem', '/etc/letsencrypt/live/book.depaoli.id.au/privkey.pem'), host="0.0.0.0", debug=False)
|
||||||
Reference in New Issue
Block a user