TODO-24 (in docker) DONE
This commit is contained in:
7
README
7
README
@@ -24,10 +24,7 @@ python3 main.py
|
||||
MUST use form.errors when we have a validator that is fancier than not empty (year_published in book and num_books in series SO FAR)
|
||||
|
||||
|
||||
#### TODOS (next 26):
|
||||
TODO-24: get this into docker (as per TODO above)
|
||||
gunicorn and it seems easy enough: https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-18-04
|
||||
|
||||
#### TODOS (next 27):
|
||||
TODO-08: show books on shelf list
|
||||
TODO-09: show books to buy view / printable
|
||||
TODO-11: show unrated books (with toggle to exclude those with missing in a series)
|
||||
@@ -48,3 +45,5 @@ TODO-05: should deleting really just ask if want to mark it as SOLD? IN FACT, m
|
||||
TODO-20: ORM all books load is slow
|
||||
- should I lazy load all books (ajax the 2nd->last pages in, or not use ORM, and do a quick db.execute()....)
|
||||
TODO-21: allow a way to add a book as a child of another existing book (opposite of rem_sub_book)
|
||||
|
||||
TODO-26: gunicorn and/or more modern non-flask???
|
||||
|
||||
16
main.py
16
main.py
@@ -7,15 +7,20 @@ from wtforms import SubmitField, StringField, HiddenField, SelectField, IntegerF
|
||||
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
|
||||
DB_URL = 'postgresql+psycopg2://ddp:NWNlfa01@127.0.0.1:5432/library'
|
||||
# using temp.docker DB conn string
|
||||
DB_URL = 'postgresql+psycopg2://ddp:blahdeblah@172.18.0.20:5432/library'
|
||||
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
|
||||
@@ -644,4 +649,7 @@ def main_page():
|
||||
return render_template("base.html", alert=st.GetAlert(), message=st.GetMessage())
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host="0.0.0.0", debug=True)
|
||||
if hostname == DEV_HOST:
|
||||
app.run(host="0.0.0.0", debug=True)
|
||||
else:
|
||||
app.run(host="0.0.0.0", debug=False)
|
||||
|
||||
Reference in New Issue
Block a user