Rename flask launchers -> _dev, _prod.

I want to reduce some complexity around here, part of which is that
launch imported entrypoint imported backend, all to do some proxy
wrapping which isn't necessary for the dev case anyway. Less
layers of wrapping and importing is good. Plus I think this naming
is more clear.
master
voussoir 2020-09-30 15:05:44 -07:00
parent fc894bcd17
commit 59cc76f8d9
3 changed files with 14 additions and 10 deletions

View File

@ -50,15 +50,15 @@ I have not made a setup.py yet. So I use a filesystem junction / symlink to make
<details><summary><strong>Click to view run instructions</strong></summary>
<details><summary><strong>Running Flask locally</strong></summary>
- Run `python etiquette_flask_launch.py [port]` to launch the flask server. Port defaults to 5000 if not provided.
- Run `python etiquette_flask_dev.py [port]` to launch the flask server. Port defaults to 5000 if not provided.
- Run `python -i etiquette_repl_launch.py` to launch the Python interpreter with the PhotoDB pre-loaded into a variable called `P`. Try things like `P.new_photo` or `P.digest_directory`.
- Note: Do not `cd` into the frontends folder. Stay wherever you want the photodb to be created, and start the frontend by specifying full file path of the launch file.
Windows:
D:\somewhere> python D:\Git\Etiquette\frontends\etiquette_flask\etiquette_flask_launch.py 5001
D:\somewhere> python D:\Git\Etiquette\frontends\etiquette_flask\etiquette_flask_dev.py 5001
Linux:
/somewhere $ python /home/Owner/Git/Etiquette/frontends/etiquette_flask/etiquette_flask_launch.py 5001
/somewhere $ python /home/Owner/Git/Etiquette/frontends/etiquette_flask/etiquette_flask_dev.py 5001
</details>
@ -72,7 +72,7 @@ I have not made a setup.py yet. So I use a filesystem junction / symlink to make
2. To run non-daemonized, on a specific port, with logging to the terminal, use:
gunicorn etiquette_flask_entrypoint:site --bind "0.0.0.0:PORT" --access-logfile "-"
gunicorn etiquette_flask_prod:site --bind "0.0.0.0:PORT" --access-logfile "-"
</details>
</details>

View File

@ -2,7 +2,7 @@
This file is the gevent launcher for local / development use.
Simply run it on the command line:
python etiquette_flask_launch.py [port]
python etiquette_flask_dev.py [port]
'''
import gevent.monkey; gevent.monkey.patch_all()
@ -18,7 +18,11 @@ import sys
from voussoirkit import pathclass
import etiquette_flask_entrypoint
import backend
####################################################################################################
site = backend.site
HTTPS_DIR = pathclass.Path(__file__).parent.with_child('https')
@ -29,17 +33,17 @@ def etiquette_flask_launch(create, port, use_https):
if use_https:
http = gevent.pywsgi.WSGIServer(
listener=('0.0.0.0', port),
application=etiquette_flask_entrypoint.site,
application=site,
keyfile=HTTPS_DIR.with_child('etiquette.key').absolute_path,
certfile=HTTPS_DIR.with_child('etiquette.crt').absolute_path,
)
else:
http = gevent.pywsgi.WSGIServer(
listener=('0.0.0.0', port),
application=etiquette_flask_entrypoint.site,
application=site,
)
etiquette_flask_entrypoint.backend.common.init_photodb(create=create)
backend.common.init_photodb(create=create)
message = f'Starting server on port {port}'
if use_https:

View File

@ -2,7 +2,7 @@
This file is the WSGI entrypoint for remote / production use.
If you are using Gunicorn, for example:
gunicorn etiquette_flask_entrypoint:site --bind "0.0.0.0:PORT" --access-logfile "-"
gunicorn etiquette_flask_prod:site --bind "0.0.0.0:PORT" --access-logfile "-"
'''
import werkzeug.middleware.proxy_fix