basic webapp
This commit is contained in:
parent
7d67b59f5a
commit
f947999cd1
33
setup.cfg
33
setup.cfg
|
@ -1,14 +1,14 @@
|
|||
[metadata]
|
||||
name = basicpy
|
||||
version = 0.0.1
|
||||
name = wikinotes
|
||||
version = 0.1
|
||||
author = Thomas Lindner
|
||||
author_email = tom@dl6tom.de
|
||||
description = Basic python package
|
||||
description = Simple Wiki
|
||||
long_description = file: README.md
|
||||
long_description_content_type = text/markdown
|
||||
url = https://git.0x90.space/vmann/basicpy
|
||||
url = https://git.0x90.space/vmann/wikinotes
|
||||
project_urls =
|
||||
Bug Tracker = https://git.0x90.space/vmann/basicpy/issues
|
||||
Bug Tracker = https://git.0x90.space/vmann/wikinotes/issues
|
||||
classifiers =
|
||||
Programming Language :: Python :: 3
|
||||
License :: OSI Approved :: ISC License (ISCL)
|
||||
|
@ -18,19 +18,26 @@ classifiers =
|
|||
package_dir =
|
||||
= src
|
||||
packages = find:
|
||||
python_requires = >=3.8
|
||||
#install_requires =
|
||||
# dependency
|
||||
python_requires = >=3.10
|
||||
install_requires =
|
||||
jinja2
|
||||
starlette
|
||||
uvicorn[standard]
|
||||
|
||||
[options.packages.find]
|
||||
where = src
|
||||
|
||||
[options.package_data]
|
||||
wikinotes =
|
||||
statics/**
|
||||
templates/**
|
||||
|
||||
[options.entry_points]
|
||||
console_scripts =
|
||||
basicpy = basicpy:main
|
||||
wikinotes = wikinotes:main
|
||||
|
||||
[tox:tox]
|
||||
envlist = lint, py38, py39
|
||||
envlist = lint, py310
|
||||
isolated_build = True
|
||||
|
||||
[testenv:lint]
|
||||
|
@ -38,16 +45,18 @@ skip_install = True
|
|||
deps =
|
||||
black
|
||||
flake8
|
||||
mypy
|
||||
commands =
|
||||
black --check --diff src tests
|
||||
flake8 src tests
|
||||
mypy --disallow-untyped-defs src tests
|
||||
|
||||
[testenv]
|
||||
deps =
|
||||
mypy
|
||||
pyright
|
||||
pytest
|
||||
commands =
|
||||
mypy --disallow-untyped-defs src tests
|
||||
pyright src tests
|
||||
pytest tests
|
||||
|
||||
[flake8]
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
def main() -> None:
|
||||
print("Hello World")
|
31
src/wikinotes/__init__.py
Normal file
31
src/wikinotes/__init__.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
from jinja2 import PackageLoader
|
||||
from starlette.applications import Starlette
|
||||
from starlette.requests import Request
|
||||
from starlette.responses import Response
|
||||
from starlette.routing import Route, Mount
|
||||
from starlette.staticfiles import StaticFiles
|
||||
from starlette.templating import Jinja2Templates
|
||||
from uvicorn import run
|
||||
|
||||
|
||||
templates = Jinja2Templates(
|
||||
directory="/nonexistent", # just a dummy, FileSystemLoader is not used
|
||||
loader=PackageLoader("wikinotes"),
|
||||
)
|
||||
|
||||
|
||||
async def home(request: Request) -> Response:
|
||||
return templates.TemplateResponse("home.html", context={"request": request})
|
||||
|
||||
|
||||
app = Starlette(
|
||||
debug=True,
|
||||
routes=[
|
||||
Route("/", home, name="home"),
|
||||
Mount("/static", app=StaticFiles(packages=["wikinotes"]), name="static"),
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
run("wikinotes:app", port=8080, log_level="info")
|
7
src/wikinotes/statics/bootstrap.bundle.min.js
vendored
Normal file
7
src/wikinotes/statics/bootstrap.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
src/wikinotes/statics/bootstrap.min.css
vendored
Normal file
6
src/wikinotes/statics/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
src/wikinotes/statics/htmx.min.js
vendored
Normal file
1
src/wikinotes/statics/htmx.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
src/wikinotes/statics/style.css
Normal file
6
src/wikinotes/statics/style.css
Normal file
|
@ -0,0 +1,6 @@
|
|||
body {
|
||||
padding-top: 4.5rem; /* ensure fixed-top navbar does not overlap */
|
||||
}
|
||||
nav {
|
||||
--bs-emphasis-color-rgb: var(--bs-white-rgb);
|
||||
}
|
29
src/wikinotes/templates/base.html
Normal file
29
src/wikinotes/templates/base.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>WikiNotes</title>
|
||||
<link href="{{ url_for("static", path="bootstrap.min.css") }}" rel="stylesheet">
|
||||
<link href="{{ url_for("static", path="style.css") }}" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-sm fixed-top bg-primary bg-gradient">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="{{ url_for("home") }}">WikiNotes</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
|
||||
data-bs-target="#toolbar" aria-controls="toolbar"
|
||||
aria-expanded="false" aria-label="toggle toolbar">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div id="toolbar" class="collapse navbar-collapse">
|
||||
{% block nav %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<main class="container">
|
||||
{% block main %}{% endblock %}
|
||||
</main>
|
||||
<script src="{{ url_for("static", path="bootstrap.bundle.min.js") }}"></script>
|
||||
<script src="{{ url_for("static", path="htmx.min.js") }}"></script>
|
||||
</body>
|
||||
</html>
|
41
src/wikinotes/templates/home.html
Normal file
41
src/wikinotes/templates/home.html
Normal file
|
@ -0,0 +1,41 @@
|
|||
{% extends "base.html" %}
|
||||
{% block main %}
|
||||
<p>
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce fermentum arcu sit amet
|
||||
libero semper, et malesuada mauris vulputate. Praesent vitae congue magna. Morbi in quam
|
||||
quis metus dignissim ultricies quis sit amet tellus. Suspendisse potenti. Maecenas
|
||||
dictum leo et justo lobortis cursus. Etiam id risus ex. Vestibulum a est mi. Vivamus in
|
||||
accumsan est. Nullam eleifend, mi quis accumsan ornare, nisl diam malesuada diam, a
|
||||
interdum enim ipsum vel erat. Phasellus justo neque, convallis ut lacus ut, convallis
|
||||
ultrices urna. Morbi in cursus diam. Pellentesque semper libero quis feugiat finibus. Ut
|
||||
nec vulputate nibh.
|
||||
<p>
|
||||
Donec tincidunt diam scelerisque, vestibulum lorem sit amet, elementum dui. Quisque
|
||||
ullamcorper velit tellus. Pellentesque lacinia vehicula gravida. Maecenas et interdum
|
||||
eros, sed cursus quam. Phasellus at mauris sed eros semper porttitor a in neque. Nullam
|
||||
auctor, dui sed ultrices fermentum, ex justo pretium sem, non mollis dolor est at metus.
|
||||
Fusce ultricies mollis ante. Aliquam eros magna, ullamcorper a pulvinar non, tristique
|
||||
vitae libero. Ut pretium ante id efficitur commodo. Nulla porttitor odio at pulvinar
|
||||
rhoncus. Maecenas ut fringilla eros. Quisque consectetur augue vitae mi rutrum,
|
||||
consectetur scelerisque est feugiat. Nullam ac ex eu quam tempor faucibus. Aenean ac
|
||||
pretium elit.
|
||||
<p>
|
||||
Duis vehicula felis sed velit mattis cursus sed vel orci. Nulla facilisi. Nullam
|
||||
condimentum mauris et varius accumsan. Curabitur a sem sed dolor faucibus faucibus ac ac
|
||||
ante. Etiam elementum enim aliquam dolor pulvinar varius. Quisque ac facilisis justo.
|
||||
Sed sed neque sit amet sapien condimentum vestibulum. Nulla posuere lorem sit amet
|
||||
luctus ornare.
|
||||
<p>
|
||||
Vestibulum ac lacus egestas, lacinia ipsum quis, tempus arcu. Morbi sodales tincidunt
|
||||
erat ac fermentum. Aliquam eget interdum nulla. Quisque laoreet ultrices ex quis
|
||||
tincidunt. Sed placerat, mi in aliquam auctor, felis odio tristique dolor, quis molestie
|
||||
ex arcu in orci. Vivamus interdum suscipit turpis vel commodo. Aenean facilisis dolor
|
||||
sit amet consequat lobortis.
|
||||
<p>
|
||||
Etiam porta id sapien a interdum. Nullam nec augue id quam feugiat consequat at ut orci.
|
||||
Quisque aliquet, mauris vel tincidunt ultricies, tellus nibh tincidunt nibh, eu pretium
|
||||
magna diam et felis. Etiam nec sagittis lorem. Quisque tempus, velit quis scelerisque
|
||||
semper, nibh urna pharetra odio, ac lacinia nunc ligula vitae mi. Donec tellus neque,
|
||||
gravida non elementum facilisis, tristique vitae diam. Sed ullamcorper volutpat semper.
|
||||
Suspendisse eu tellus ultricies, placerat nibh quis, elementum augue.
|
||||
{% endblock %}
|
Loading…
Reference in a new issue