updating web-dev
This commit is contained in:
138
examples/base/.gitignore
vendored
Normal file
138
examples/base/.gitignore
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
pip-wheel-metadata/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# custom ignores
|
||||
*node_modules/
|
||||
*bower_components/
|
||||
8
examples/base/Dockerfile
Normal file
8
examples/base/Dockerfile
Normal file
@@ -0,0 +1,8 @@
|
||||
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
|
||||
|
||||
RUN ["pip", "install", "aiofiles", "jinja2" ]
|
||||
|
||||
COPY ./api_datadisplay /app
|
||||
COPY ./node_modules /node_modules
|
||||
COPY ./bower_components /bower_components
|
||||
COPY ./static /static
|
||||
0
examples/base/README.rst
Normal file
0
examples/base/README.rst
Normal file
1
examples/base/base/__init__.py
Normal file
1
examples/base/base/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
__version__ = '0.1.0'
|
||||
31
examples/base/base/main.py
Normal file
31
examples/base/base/main.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from starlette.applications import Starlette
|
||||
from starlette.templating import Jinja2Templates
|
||||
from starlette.routing import Route, Mount
|
||||
from starlette.staticfiles import StaticFiles
|
||||
|
||||
|
||||
templates = Jinja2Templates(directory='templates')
|
||||
|
||||
|
||||
async def home(request):
|
||||
return templates.TemplateResponse(
|
||||
'index.html',
|
||||
{'request': request},
|
||||
)
|
||||
|
||||
routes = [
|
||||
Route('/', endpoint=home),
|
||||
Mount('/static', StaticFiles(directory='../static'), name='static'),
|
||||
Mount(
|
||||
'/node_modules',
|
||||
StaticFiles(directory='../node_modules'),
|
||||
name='node_modules',
|
||||
),
|
||||
Mount(
|
||||
'/bower_components',
|
||||
StaticFiles(directory='../bower_components'),
|
||||
name='bower_components',
|
||||
),
|
||||
]
|
||||
|
||||
app = Starlette(debug=True, routes=routes)
|
||||
42
examples/base/base/templates/index.html
Normal file
42
examples/base/base/templates/index.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="Capacity Dashboard">
|
||||
<meta name="author" content="capacity">
|
||||
<title>api data-display</title>
|
||||
<!-- favicon -->
|
||||
<link rel="shortcut icon" href="{{ url_for('static', path='assets/favicon/favicon-192x192.png')}}">
|
||||
<!-- CSS -->
|
||||
<!-- bootstrap css -->
|
||||
<link rel="stylesheet" type="text/css" href="{{ url_for('node_modules', path='/bootswatch/dist/flatly/bootstrap.min.css') }}">
|
||||
<!-- fakeloader css -->
|
||||
<link rel="stylesheet" type="text/css" href="{{ url_for('node_modules', path='/jq-fakeloader/css/fakeLoader.css') }}">
|
||||
</head>
|
||||
<body>
|
||||
<!-- javascript -->
|
||||
<!-- jquery js -->
|
||||
<script type="text/javascript" src="{{ url_for('node_modules', path='/jquery/dist/jquery.min.js') }}"></script>
|
||||
<!-- bootstrap js -->
|
||||
<script type="text/javascript" src="{{ url_for('node_modules', path='/bootstrap/dist/js/bootstrap.bundle.js') }}"></script>
|
||||
<!-- font-awesome js -->
|
||||
<script type="text/javascript" src="{{ url_for('node_modules', path='/@fortawesome/fontawesome-free/js/fontawesome.min.js') }}"></script>
|
||||
<!-- fakeloader js -->
|
||||
<script type="text/javascript" src="{{ url_for('node_modules', path='/jq-fakeloader/js/fakeLoader.js') }}"></script>
|
||||
<!-- load scripts -->
|
||||
<script type="text/javascript">
|
||||
$.fakeLoader({'timeToHide':1200, 'spinner':'spinner4', 'bgColor': '#00003c'});
|
||||
</script>
|
||||
<script type="text/javascript">$('.toast').toast()</script>
|
||||
<!-- begin document -->
|
||||
<div class="jumbotron">
|
||||
<h1 class="display-4">Hello, world! <i class="fas fa-globe-europe"></i></h1>
|
||||
<p class="lead">This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p>
|
||||
<hr class="my-4">
|
||||
<p>It uses utility classes for typography and spacing to space content out within the larger container.</p>
|
||||
<a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
17
examples/base/bower.json
Normal file
17
examples/base/bower.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "api-datadisplay",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"authors": [
|
||||
"dtomlinson <dtomlinson@panaetius.co.uk>"
|
||||
],
|
||||
"license": "ISC",
|
||||
"homepage": "",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
]
|
||||
}
|
||||
33
examples/base/package-lock.json
generated
Normal file
33
examples/base/package-lock.json
generated
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "api-datadisplay",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": {
|
||||
"version": "5.12.1",
|
||||
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.12.1.tgz",
|
||||
"integrity": "sha512-ZtjIIFplxncqxvogq148C3hBLQE+W3iJ8E4UvJ09zIJUgzwLcROsWwFDErVSXY2Plzao5J9KUYNHKHMEUYDMKw=="
|
||||
},
|
||||
"bootstrap": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.4.1.tgz",
|
||||
"integrity": "sha512-tbx5cHubwE6e2ZG7nqM3g/FZ5PQEDMWmMGNrCUBVRPHXTJaH7CBDdsLeu3eCh3B1tzAxTnAbtmrzvWEvT2NNEA=="
|
||||
},
|
||||
"bootswatch": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/bootswatch/-/bootswatch-4.4.1.tgz",
|
||||
"integrity": "sha512-Kx3z6+3Jpg9g6l/xZBCnc8d6KeJK0QawxCZWOomdcI5AuSZLZb+DoH5X9RJH+cOcSeMAxyzdIjkVUR01+Db5bQ=="
|
||||
},
|
||||
"jq-fakeloader": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/jq-fakeloader/-/jq-fakeloader-2.0.1.tgz",
|
||||
"integrity": "sha512-INQYTpFJON2nD4TMTXifB4UCW03tSzCbAog+pUEUtVsJqzS7qoznW9OrAt/HUfvFMykx95WQXWFbrc3Uq9pagA=="
|
||||
},
|
||||
"jquery": {
|
||||
"version": "3.4.1",
|
||||
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz",
|
||||
"integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw=="
|
||||
}
|
||||
}
|
||||
}
|
||||
23
examples/base/package.json
Normal file
23
examples/base/package.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "api-datadisplay",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"directories": {
|
||||
"test": "tests"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": "^5.12.1",
|
||||
"bootstrap": "^4.4.1",
|
||||
"bootswatch": "^4.4.1",
|
||||
"fakeloader": "^1.0.0",
|
||||
"jq-fakeloader": "^2.0.1",
|
||||
"jquery": "^3.4.1"
|
||||
}
|
||||
}
|
||||
20
examples/base/pyproject.toml
Normal file
20
examples/base/pyproject.toml
Normal file
@@ -0,0 +1,20 @@
|
||||
[tool.poetry]
|
||||
name = "base"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = ["dtomlinson <dtomlinson@panaetius.co.uk>"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.7"
|
||||
fastapi = "^0.49.0"
|
||||
requests = "^2.22"
|
||||
jinja2 = "^2.11"
|
||||
aiofiles = "^0.4.0"
|
||||
uvicorn = "^0.11.3"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
pytest = "^3.0"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry>=0.12"]
|
||||
build-backend = "poetry.masonry.api"
|
||||
4
examples/base/static/.gitignore
vendored
Normal file
4
examples/base/static/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
||||
0
examples/base/tests/__init__.py
Normal file
0
examples/base/tests/__init__.py
Normal file
5
examples/base/tests/test_api_datadisplay.py
Normal file
5
examples/base/tests/test_api_datadisplay.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from api_datadisplay import __version__
|
||||
|
||||
|
||||
def test_version():
|
||||
assert __version__ == '0.1.0'
|
||||
28
examples/base/yarn.lock
Normal file
28
examples/base/yarn.lock
Normal file
@@ -0,0 +1,28 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@fortawesome/fontawesome-free@^5.12.1":
|
||||
version "5.12.1"
|
||||
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.12.1.tgz#2a98fea9fbb8a606ddc79a4680034e9d5591c550"
|
||||
integrity sha512-ZtjIIFplxncqxvogq148C3hBLQE+W3iJ8E4UvJ09zIJUgzwLcROsWwFDErVSXY2Plzao5J9KUYNHKHMEUYDMKw==
|
||||
|
||||
bootstrap@^4.4.1:
|
||||
version "4.4.1"
|
||||
resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.4.1.tgz#8582960eea0c5cd2bede84d8b0baf3789c3e8b01"
|
||||
integrity sha512-tbx5cHubwE6e2ZG7nqM3g/FZ5PQEDMWmMGNrCUBVRPHXTJaH7CBDdsLeu3eCh3B1tzAxTnAbtmrzvWEvT2NNEA==
|
||||
|
||||
bootswatch@^4.4.1:
|
||||
version "4.4.1"
|
||||
resolved "https://registry.yarnpkg.com/bootswatch/-/bootswatch-4.4.1.tgz#f270618b4ebe07de8e1748acd88f104cc31bfec3"
|
||||
integrity sha512-Kx3z6+3Jpg9g6l/xZBCnc8d6KeJK0QawxCZWOomdcI5AuSZLZb+DoH5X9RJH+cOcSeMAxyzdIjkVUR01+Db5bQ==
|
||||
|
||||
fakeloader@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/fakeloader/-/fakeloader-1.0.0.tgz#f8fa8041c13a4b95d2375650b388a0b8ddf087b1"
|
||||
integrity sha512-Osfya50BPEONGUPsFlQhGx/oblMiCbk8HVu5BSVsDqTOgHitcyM5bDkdLGKObSRV8TGzaqbhHyh5DXEdCxOxuQ==
|
||||
|
||||
jquery@^3.4.1:
|
||||
version "3.4.1"
|
||||
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.4.1.tgz#714f1f8d9dde4bdfa55764ba37ef214630d80ef2"
|
||||
integrity sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==
|
||||
Reference in New Issue
Block a user