Rename the etiquette_flask backend package to backend.

Alright, I got tired of confusing myself with the same-named
outer and inner package.
Keep in mind that every frontend implementation is supposed to be
its own independent project where etiquette is nothing but a
dependency. So the name backend is not ambiguous with the etiquette
backend.
This commit is contained in:
voussoir 2018-11-04 19:45:23 -08:00
parent dbdd509cd2
commit 6e312bd287
17 changed files with 11 additions and 8 deletions

View file

@ -29,7 +29,9 @@ I have not made a setup.py yet. So I use a filesystem junction / symlink to make
<details><summary><strong>Setting up via pythonpath</strong></summary> <details><summary><strong>Setting up via pythonpath</strong></summary>
- The repository you're looking at right now is `D:\Git\Etiquette`. The toplevel `etiquette` folder is the main package. We want the repository to be treated as an alternative lib directory, because the package is a child of it. - The repository you're looking at right now is `D:\Git\Etiquette`. The toplevel `etiquette` folder is the main package.
The pythonpath points to directories that *contain* the packages you need to import, not to the packages themselves. Therefore we point to the repository.
Windows: `set "PYTHONPATH=%PYTHONPATH%;D:\Git\Etiquette"` Windows: `set "PYTHONPATH=%PYTHONPATH%;D:\Git\Etiquette"`
Note the semicolon to delimit paths. Note the semicolon to delimit paths.
@ -54,13 +56,16 @@ I have not made a setup.py yet. So I use a filesystem junction / symlink to make
Linux: 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_launch.py 5001
</details> </details>
--- ---
<details><summary><strong>Running with Gunicorn</strong></summary> <details><summary><strong>Running with Gunicorn</strong></summary>
1. Use the PYTHONPATH technique to make `etiquette` and `etiquette_flask` both importable. Symlinking into the lib is not as convenient here because the server relies on the static files and jinja templates relative to the code's location. 1. Use the PYTHONPATH technique to make `etiquette` and the flask `backend` both importable. Symlinking into the lib is not as convenient here because the server relies on the static files and jinja templates relative to the code's location.
The Pythonpath points to directories that *contain* the packages you need to import, not to the packages themselves. Therefore we point to the etiquette and frontend repositories.
PYTHONPATH="$PYTHONPATH:/home/Owner/Git/Etiquette:/home/Owner/Git/Etiquette/frontends/etiquette_flask PYTHONPATH="$PYTHONPATH:/home/Owner/Git/Etiquette:/home/Owner/Git/Etiquette/frontends/etiquette_flask
@ -87,9 +92,7 @@ Here is a brief overview of the project to help you learn your way around:
- `frontends` - `frontends`
Ideally, the backend should be frontend-agnostic. Even though the Flask interface is my primary interest, it should not feel like it must be the only one. Therefore I place it in this folder to indicate that other frontends are possible too. Every folder here is essentially a completely separate project. Ideally, the backend should be frontend-agnostic. Even though the Flask interface is my primary interest, it should not feel like it must be the only one. Therefore I place it in this folder to indicate that other frontends are possible too. Every folder here is essentially a completely separate project.
- `etiquette_flask` - `etiquette_flask`
This folder represents the flask server as somewhat of a black box, in the sense that you can move it around and just run the contained launch file. Subfolders contain the HTML templates, static files, and site code. This folder represents the flask server as somewhat of a black box, in the sense that you can move it around and just run the contained launch file. Subfolders contain the HTML templates, static files, and site's backend code.
- `etiquette_flask`
The package that contains the site's actual API code.
- `etiquette_repl` - `etiquette_repl`
Preloads a few variables into the interpreter so you can quickly test functions within the Python REPL itself. Preloads a few variables into the interpreter so you can quickly test functions within the Python REPL itself.
- `utilities` - `utilities`

View file

@ -7,8 +7,8 @@ gunicorn etiquette_flask_entrypoint:site --bind "0.0.0.0:PORT" --access-logfile
import sys import sys
import werkzeug.contrib.fixers import werkzeug.contrib.fixers
import etiquette_flask import backend
etiquette_flask.site.wsgi_app = werkzeug.contrib.fixers.ProxyFix(etiquette_flask.site.wsgi_app) backend.site.wsgi_app = werkzeug.contrib.fixers.ProxyFix(backend.site.wsgi_app)
site = etiquette_flask.site site = backend.site