Fix an issue with hypercorn not finding the application in the docker image; correct the README; fix a co-routine that wasn't being awaited
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful

This commit is contained in:
Raoul Snyman 2023-07-29 21:58:59 -07:00
parent 8a355f59a5
commit c04b2a4102
4 changed files with 6 additions and 6 deletions

View File

@ -6,4 +6,4 @@ RUN pip install -e .
RUN pip install hypercorn
EXPOSE 8000
CMD ["hypercorn", "codesmidgen.app"]
CMD ["hypercorn", "codesmidgen.app:application"]

View File

@ -3,4 +3,4 @@ FROM python:3.11
RUN pip install --extra-index-url https://git.snyman.info/api/packages/raoul/pypi/simple/ CodeSmidgen hypercorn
EXPOSE 8000
CMD ["hypercorn", "codesmidgen.app"]
CMD ["hypercorn", "codesmidgen.app:application"]

View File

@ -26,7 +26,7 @@ The easiest way to install CodeSmidgen is via Docker and Docker Compose. Here's
image: git.snyman.info/raoul/codesmidgen:latest
env:
- SMIDGEN_SECRET_KEY=yoursecrethere
- SQLALCHEMY_DATABASE_URL=postgres://codesmidgen:codesmidgen@postgres/codesmidgen
- SQLALCHEMY_DATABASE_URI=postgresql://codesmidgen:codesmidgen@postgres/codesmidgen
restart: unless-stopped
ports:
- "127.0.0.1:8000:8000"

View File

@ -101,7 +101,7 @@ async def save() -> Response:
session.commit()
return redirect('/' + note.url)
except Exception as e:
flash(str(e), 'danger')
await flash(str(e), 'danger')
session.rollback()
return redirect('/')
@ -115,7 +115,7 @@ async def view(note_url: str) -> Response | str:
"""
note = Smidgen.query.filter(Smidgen.url == note_url).first()
if not note:
flash('That note does not exist', 'danger')
await flash('That note does not exist', 'danger')
return redirect('/')
lexer = get_lexer_by_name(note.lexer)
@ -133,7 +133,7 @@ async def raw(note_url: str) -> Response | str:
"""
note = Smidgen.query.filter(Smidgen.url == note_url).scalar()
if not note:
flash('That note does not exist', 'danger')
await flash('That note does not exist', 'danger')
return redirect('/')
return await render_template('raw.html', source=note.source), 200, {'Content-Type': 'text/plain; charset=utf-8'}