diff --git a/amarillo/app/main.py b/amarillo/app/main.py index 6935f96..746ece7 100644 --- a/amarillo/app/main.py +++ b/amarillo/app/main.py @@ -1,17 +1,19 @@ import logging.config - -from amarillo.app.configuration import configure_services, configure_admin_token - -logging.config.fileConfig('logging.conf', disable_existing_loggers=False) -logger = logging.getLogger("main") +import importlib +import pkgutil import uvicorn import mimetypes from starlette.staticfiles import StaticFiles - +import amarillo.plugins +from amarillo.app.configuration import configure_services, configure_admin_token from amarillo.app.routers import carpool, agency, agencyconf, region from fastapi import FastAPI +from amarillo.app.views import home + +logging.config.fileConfig('logging.conf', disable_existing_loggers=False) +logger = logging.getLogger("main") # https://pydantic-docs.helpmanual.io/usage/settings/ # from amarillo.app.views import home @@ -75,13 +77,6 @@ app.include_router(agencyconf.router) app.include_router(region.router) -import importlib -import pkgutil - -import amarillo.plugins - - - def iter_namespace(ns_pkg): # Source: https://packaging.python.org/guides/creating-and-discovering-plugins/ return pkgutil.iter_modules(ns_pkg.__path__, ns_pkg.__name__ + ".") @@ -104,15 +99,15 @@ def load_plugins(): def configure(): configure_admin_token() configure_services() - # configure_routing() + configure_routing() load_plugins() -# def configure_routing(): -# mimetypes.add_type('application/x-protobuf', '.pbf') -# app.mount('/static', StaticFiles(directory='static'), name='static') -# app.mount('/gtfs', StaticFiles(directory='data/gtfs'), name='gtfs') -# app.include_router(home.router) +def configure_routing(): + mimetypes.add_type('application/x-protobuf', '.pbf') + app.mount('/static', StaticFiles(directory='static'), name='static') + app.mount('/gtfs', StaticFiles(directory='data/gtfs'), name='gtfs') + app.include_router(home.router) if __name__ == "__main__": diff --git a/amarillo/app/views/home.py b/amarillo/app/views/home.py new file mode 100644 index 0000000..4c044c3 --- /dev/null +++ b/amarillo/app/views/home.py @@ -0,0 +1,17 @@ +import fastapi +from starlette.requests import Request +from starlette.templating import Jinja2Templates + +templates = Jinja2Templates('templates') + +router = fastapi.APIRouter() + +@router.get('/', include_in_schema=False) +async def index(request: Request): + + return templates.TemplateResponse('home/index.html', {"request": request}) + + +@router.get('/favicon.ico', include_in_schema=False) +def favicon(): + return fastapi.responses.RedirectResponse(url='/static/img/favicon.ico') diff --git a/static/css/docs.css b/static/css/docs.css new file mode 100644 index 0000000..aca49e8 --- /dev/null +++ b/static/css/docs.css @@ -0,0 +1,33 @@ +.request { + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + font-weight: bold; + border: 1px solid gray; + border-radius: 5px; + padding: 10px; + font-size: 24px; +} + +.get { + color: #2b542c; + background-color: #beffbd; +} + +.post { + color: #ae5900; + background-color: #ffc79d; +} + +.response_formats span { + font-weight: bold; + color: darkred; + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} + +pre { + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} + +ul li { + font-size: 18px; + margin-bottom: 10px; +} \ No newline at end of file diff --git a/static/css/theme.css b/static/css/theme.css new file mode 100644 index 0000000..d522087 --- /dev/null +++ b/static/css/theme.css @@ -0,0 +1,186 @@ +@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700); + +body { + font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; + font-weight: 300; + color: black; + background: white; + padding-left: 20px; + padding-right: 20px; +} + +h1, +h2, +h3, +h4, +h5, +h6 { + font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; + font-weight: 300; +} + +p { + font-weight: 300; +} + +.font-normal { + font-weight: 400; +} + +.font-semi-bold { + font-weight: 600; +} + +.font-bold { + font-weight: 700; +} + +.starter-template { + margin-top: 25px; +} + +.starter-template .content { + margin-left: 10px; +} + +.starter-template .content h1 { + margin-top: 10px; + font-size: 60px; +} + +.starter-template .content h1 .smaller { + font-size: 40px; +} + +.starter-template .content .lead { + font-size: 25px; +} + +.starter-template .links { + float: right; + right: 0; + margin-top: 125px; +} + +.starter-template .links ul { + display: block; + padding: 0; + margin: 0; +} + +.starter-template .links ul li { + list-style: none; + display: inline; + margin: 0 10px; +} + +.starter-template .links ul li:first-child { + margin-left: 0; +} + +.starter-template .links ul li:last-child { + margin-right: 0; +} + +.starter-template .links ul li.current-version { + font-weight: 400; +} + +.starter-template .links ul li a, a { + text-decoration: underline; +} + +.starter-template .links ul li a:hover, a:hover { + text-decoration: underline; +} + +.starter-template .links ul li .icon-muted { + margin-right: 5px; +} + +.starter-template .copyright { + margin-top: 10px; + font-size: 0.9em; + text-transform: lowercase; + float: right; + right: 0; +} + +@media (max-width: 1199px) { + .starter-template .content h1 { + font-size: 45px; + } + + .starter-template .content h1 .smaller { + font-size: 30px; + } + + .starter-template .content .lead { + font-size: 20px; + } +} + +@media (max-width: 991px) { + .starter-template { + margin-top: 0; + } + + .starter-template .logo { + margin: 40px auto; + } + + .starter-template .content { + margin-left: 0; + text-align: center; + } + + .starter-template .content h1 { + margin-bottom: 20px; + } + + .starter-template .links { + float: none; + text-align: center; + margin-top: 60px; + } + + .starter-template .copyright { + float: none; + text-align: center; + } +} + +@media (max-width: 767px) { + .starter-template .content h1 .smaller { + font-size: 25px; + display: block; + } + + .starter-template .content .lead { + font-size: 16px; + } + + .starter-template .links { + margin-top: 40px; + } + + .starter-template .links ul li { + display: block; + margin: 0; + } + + .starter-template .links ul li .icon-muted { + display: none; + } + + .starter-template .copyright { + margin-top: 20px; + } +} + + +.disclaimer { + margin-top: 20px; + font-style: italic; + +} \ No newline at end of file diff --git a/static/img/cloud.png b/static/img/cloud.png new file mode 100644 index 0000000..b3393ba Binary files /dev/null and b/static/img/cloud.png differ diff --git a/static/img/favicon.ico b/static/img/favicon.ico new file mode 100644 index 0000000..aa1c995 Binary files /dev/null and b/static/img/favicon.ico differ diff --git a/templates/home/index.html b/templates/home/index.html new file mode 100644 index 0000000..2a176cc --- /dev/null +++ b/templates/home/index.html @@ -0,0 +1,34 @@ +{% extends "shared/layout.html" %} + +{% block content %} + +

+ Amarillo - Der Carpooling-Intermediär +

+

Hintergrund

+

+ Ein "Amarillo" ist ein gelb gekleideter Verkehrsregler, der auf Kuba Trampern eine möglichst passsende Mitfahrgelegenheit vermittelt. +

+

+ Ebenso wie ein kubanischer Amarillo hilft auch dieser Amarillo-Dienst, passende Mitfahrgelegenheiten zu vermitteln. Mitfahrplattformen können Mitfahrangebote ihrer + Nutzerinnen über die Amarillo-REST-API publizieren und so Reiseplanern oder Meta-Suchmaschinen zur Verfügung stellen. +

+

+ Amarillo reichert diese Mitfahrangebote um die mutmaßliche Fahrtroute sowie entlang + dieser liegenden Zustiegs- und Ausstiegspunkte an, so dass Reiseplaner für Mitfahrene gut erreichbare Treffpunkte vorschlagen können, die mit geringen Umwegen angefahren werden können, wie z.B. Parken-und-Mitfahren-Parkplätze, Bahnhöfe oder Bushaltestellen. +

+

+ Für die einfache Integration in Reiseplaner stellt Amarillo die Mitfahrangebote aller + publizierenen Mitfahrbörsen nächtlich als regionale GTFS-Feeds bzw. minütlich als GTFS-RT Feeds bereit. Der GTFS-RT-Feed enthält alle seit dem Vortag um Mitternacht hinzugefügten, aktualisierten oder gelöschten Mitfahrangebote als ADDED bzw. CANCELED TripUpdates. Die amarillo-spezifischen Erweiterungen werden in dieser Prototype-Extension definiert. +

+

+ Die DigitalAgentur Brandenburg GmbH als Betreiber dieses Amarillo-Dienstes für die kommunale Mobilitätsplattform bbnavi.de und das Mitfahrangebot mitfahrenbb.de ist offen für die Aufnahme weiterer Mitfahrplattformen – sowohl für die Integration von Mitfahrangeboten über Amarillo als auch für das Aufgeben von Angeboten über unsere Seiten. Möchte die Mitfahrplatfform minutenaktuelle Mitfahrangebote bereitstellen, sollte sie die carpool-POST/PUT/DELETE-Endpunkte für jede Aktualisierung eines Inserats aufrufen. Bei Interesse an einer Integration bzw. um den hierfür notwendigen API-Key zu erhalten, nehmen Sie gerne über Kontakt bbnavi at digital-agentur punkt de mit uns auf. +

+ +

Dokumentation

+

+ Die Dokumentation dieses Dienstes ist als OpenAPI-Dokumentation verfügbar. + Der Quellcode ist unter AGPL-Lizenz in diesem Github-Repository einseh- und abrufbar. +

+ +{% endblock %} \ No newline at end of file diff --git a/templates/shared/layout.html b/templates/shared/layout.html new file mode 100644 index 0000000..cdf8012 --- /dev/null +++ b/templates/shared/layout.html @@ -0,0 +1,96 @@ + + + + + + + Amarillo + + + +
+ +
+ + {% block content %} +
+ THIS PAGE HAS NO CONTENT +
+ {% endblock %} + + + + \ No newline at end of file