encode / starlette-example Goto Github PK
View Code? Open in Web Editor NEWAn example Starlette application
An example Starlette application
Is this project intended to be a single app example, or could it potentially include multiple examples of various features/usage with other libs? I am sitting on enough experiments and test code that I could probably pick out some useful things to PR in either case.
I'm in a conda environment and tried running
scripts/install
after git clone https://github.com/encode/starlette-example.git cd starlette-example
and got
scripts/install: line 1: virtualenv: command not found
scripts/install: line 2: venv/bin/pip: No such file or directory
I face the following error.
Traceback (most recent call last):
File "app.py", line 4, in <module>
from starlette.templating import Jinja2Templates
ModuleNotFoundError: No module named 'starlette.templating'
The starlette
was installed using conda
but the templating
module is not present in that.
Add pre-commit config and GitHub Action to prevent code formatting issues on pull requests.
E. g. .pre-commit-config.yaml
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
.github/workflows/main.yml
name: CI
on:
push
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.7"
- uses: pre-commit/[email protected]
if: always()
When I deploy the app on Heroku [1], all the url_for
s in base.html give me URLs with http instead of https, which triggers a Mixed Content error. When I run uvicorn locally using ssl_keyfile
and ssl_certfile
, I don't get this problem.
Links:
[1] https://aqueous-waters-64836.herokuapp.com/
On heroku, using
web: gunicorn app:app
in the Procfile leads to an error:
Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/sync.py", line 135, in handle
self.handle_request(listener, req, client, addr)
File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/sync.py", line 176, in handle_request
respiter = self.wsgi(environ, resp.start_response)
TypeError: __call__() takes 2 positional arguments but 3 were given
It'd be nice to add a tests.py
to demonstrate how to write tests against this app.
Pull requests would be very welcome! ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.