switch from app_server to `flask run` for local development

app_server doesn't emit app logging messages from gunicorn workers, and it was nontrivial to add. also app_server seems largely abandoned, and flask run is well supported.
pull/86/head
Ryan Barrett 2021-12-31 23:28:11 -08:00
rodzic 535cf7ba70
commit 0b1c8f5e7d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
3 zmienionych plików z 6 dodań i 4 usunięć

Wyświetl plik

@ -28,15 +28,15 @@ Now, run the tests to check that everything is set up ok:
```shell
gcloud beta emulators datastore start --no-store-on-disk --consistency=1.0 --host-port=localhost:8089 < /dev/null >& /dev/null &
python3 -m unittest discover
kill %1
```
Finally, run this in the repo root directory to start the web app locally:
```shell
dev_appserver.py --log_level debug --enable_host_checking false --support_datastore_emulator --datastore_emulator_port=8089 --application=bridgy-federated app.yaml
env GAE_ENV=localdev flask run -p 8080
```
If you send a pull request, please include (or update) a test for the new functionality!
If you hit an error during setup, check out the [oauth-dropins Troubleshooting/FAQ section](https://github.com/snarfed/oauth-dropins#troubleshootingfaq). For searchability, here are a handful of error messages that [have solutions there](https://github.com/snarfed/oauth-dropins#troubleshootingfaq):

4
app.py
Wyświetl plik

@ -3,6 +3,7 @@ import logging
from flask import Flask
from flask_caching import Cache
import flask_gae_static
from oauth_dropins.webutil import (
appengine_info,
appengine_config,
@ -13,7 +14,7 @@ from oauth_dropins.webutil import (
import common
app = Flask('bridgy-fed')
app = Flask(__name__)
app.template_folder = './templates'
app.config.from_mapping(
ENV='development' if appengine_info.DEBUG else 'PRODUCTION',
@ -24,6 +25,7 @@ app.config.from_mapping(
app.url_map.converters['regex'] = flask_util.RegexConverter
app.after_request(flask_util.default_modern_headers)
app.register_error_handler(Exception, flask_util.handle_exception)
flask_gae_static.init_app(app)
# don't redirect API requests with blank path elements
app.url_map.redirect_defaults = True

Wyświetl plik

@ -2,10 +2,10 @@ git+https://github.com/snarfed/django-salmon.git#egg=django_salmon
git+https://github.com/snarfed/httpsig.git@HTTPSignatureAuth-sign-header#egg=httpsig
git+https://github.com/snarfed/oauth-dropins.git#egg=oauth_dropins
git+https://github.com/snarfed/granary.git#egg=granary
app-server~=0.7.0; python_version>="3.8"
feedparser~=6.0.8
flask~=2.0.2
flask-caching~=1.10.1
flask-gae-static
google-cloud-logging~=2.7.0
gunicorn~=20.1
mf2util~=0.5.1