Creates framework for data retrieval website
This commit is contained in:
181
.idea/workspace.xml
generated
181
.idea/workspace.xml
generated
@@ -3,8 +3,6 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="28cc251f-c94f-44ee-a66d-77aaab6e3483" name="Default" comment="">
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/com/henrypump/poc/FluidShot.java" afterPath="$PROJECT_DIR$/src/main/java/com/henrypump/poc/FluidShot.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Well.java" afterPath="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Well.java" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/target/" />
|
||||
<ignored path="$PROJECT_DIR$/.gradle/" />
|
||||
@@ -90,7 +88,7 @@
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/CLScanner.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="750">
|
||||
<caret line="64" column="0" lean-forward="true" selection-start-line="64" selection-start-column="0" selection-end-line="64" selection-end-column="0" />
|
||||
<caret line="64" column="0" lean-forward="false" selection-start-line="64" selection-start-column="0" selection-end-line="64" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
@@ -101,8 +99,8 @@
|
||||
<file leaf-file-name="Well.java" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Well.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="769">
|
||||
<caret line="763" column="33" lean-forward="true" selection-start-line="763" selection-start-column="33" selection-end-line="763" selection-end-column="33" />
|
||||
<state relative-caret-position="450">
|
||||
<caret line="48" column="37" lean-forward="true" selection-start-line="48" selection-start-column="37" selection-end-line="48" selection-end-column="37" />
|
||||
<folding>
|
||||
<element signature="e#11423#11424#0" expanded="true" />
|
||||
<element signature="e#11479#11480#0" expanded="true" />
|
||||
@@ -111,11 +109,34 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="DigitalOut.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/DigitalOut.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="600">
|
||||
<caret line="51" column="4" lean-forward="false" selection-start-line="51" selection-start-column="4" selection-end-line="51" selection-end-column="4" />
|
||||
<folding>
|
||||
<element signature="e#1307#1308#0" expanded="true" />
|
||||
<element signature="e#1335#1336#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="IOControl.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/IOControl.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="614">
|
||||
<caret line="58" column="39" lean-forward="false" selection-start-line="58" selection-start-column="39" selection-end-line="58" selection-end-column="39" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="FluidShot.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/FluidShot.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="540">
|
||||
<caret line="36" column="0" lean-forward="true" selection-start-line="36" selection-start-column="0" selection-end-line="36" selection-end-column="0" />
|
||||
<caret line="36" column="0" lean-forward="false" selection-start-line="36" selection-start-column="0" selection-end-line="36" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#304#305#0" expanded="true" />
|
||||
<element signature="e#343#344#0" expanded="true" />
|
||||
@@ -141,8 +162,18 @@
|
||||
<file leaf-file-name="Database.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Database.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="725">
|
||||
<caret line="213" column="0" lean-forward="true" selection-start-line="213" selection-start-column="0" selection-end-line="213" selection-end-column="0" />
|
||||
<state relative-caret-position="105">
|
||||
<caret line="23" column="13" lean-forward="false" selection-start-line="23" selection-start-column="13" selection-end-line="23" selection-end-column="13" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="DigitalIn.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/DigitalIn.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="525">
|
||||
<caret line="39" column="5" lean-forward="false" selection-start-line="39" selection-start-column="5" selection-end-line="39" selection-end-column="5" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@@ -152,7 +183,7 @@
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Measurement.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="530">
|
||||
<caret line="114" column="21" lean-forward="true" selection-start-line="114" selection-start-column="21" selection-end-line="114" selection-end-column="21" />
|
||||
<caret line="114" column="21" lean-forward="false" selection-start-line="114" selection-start-column="21" selection-end-line="114" selection-end-column="21" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@@ -162,27 +193,7 @@
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/AnalogIn.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="725">
|
||||
<caret line="82" column="0" lean-forward="true" selection-start-line="82" selection-start-column="0" selection-end-line="82" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="IOControl.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/IOControl.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="590">
|
||||
<caret line="58" column="39" lean-forward="false" selection-start-line="58" selection-start-column="39" selection-end-line="58" selection-end-column="39" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="POC.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/POC.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="245">
|
||||
<caret line="56" column="0" lean-forward="false" selection-start-line="56" selection-start-column="0" selection-end-line="56" selection-end-column="0" />
|
||||
<caret line="82" column="0" lean-forward="false" selection-start-line="82" selection-start-column="0" selection-end-line="82" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@@ -1014,8 +1025,8 @@
|
||||
<state relative-caret-position="675">
|
||||
<caret line="51" column="4" lean-forward="false" selection-start-line="51" selection-start-column="4" selection-end-line="51" selection-end-column="4" />
|
||||
<folding>
|
||||
<element signature="e#1307#1308#0" expanded="false" />
|
||||
<element signature="e#1335#1336#0" expanded="false" />
|
||||
<element signature="e#1307#1308#0" expanded="true" />
|
||||
<element signature="e#1335#1336#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
@@ -1155,8 +1166,8 @@
|
||||
<state relative-caret-position="195">
|
||||
<caret line="19" column="4" lean-forward="false" selection-start-line="19" selection-start-column="4" selection-end-line="28" selection-end-column="5" />
|
||||
<folding>
|
||||
<element signature="e#1307#1308#0" expanded="false" />
|
||||
<element signature="e#1335#1336#0" expanded="false" />
|
||||
<element signature="e#1307#1308#0" expanded="true" />
|
||||
<element signature="e#1335#1336#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
@@ -1257,16 +1268,6 @@
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/IO.java" />
|
||||
<entry file="file://$PROJECT_DIR$/pom.xml" />
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/DigitalIn.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="525">
|
||||
<caret line="39" column="5" lean-forward="false" selection-start-line="39" selection-start-column="5" selection-end-line="39" selection-end-column="5" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="false" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/src.zip!/java/awt/Button.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="287">
|
||||
@@ -1318,6 +1319,7 @@
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@@ -1337,24 +1339,6 @@
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="515">
|
||||
<caret line="61" column="1" lean-forward="false" selection-start-line="61" selection-start-column="1" selection-end-line="61" selection-end-column="1" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/DigitalOut.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="600">
|
||||
<caret line="51" column="4" lean-forward="false" selection-start-line="51" selection-start-column="4" selection-end-line="51" selection-end-column="4" />
|
||||
<folding>
|
||||
<element signature="e#1307#1308#0" expanded="false" />
|
||||
<element signature="e#1335#1336#0" expanded="false" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/IOControl.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="590">
|
||||
<caret line="58" column="39" lean-forward="false" selection-start-line="58" selection-start-column="39" selection-end-line="58" selection-end-column="39" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@@ -1370,7 +1354,7 @@
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/AnalogIn.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="725">
|
||||
<caret line="82" column="0" lean-forward="true" selection-start-line="82" selection-start-column="0" selection-end-line="82" selection-end-column="0" />
|
||||
<caret line="82" column="0" lean-forward="false" selection-start-line="82" selection-start-column="0" selection-end-line="82" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@@ -1378,7 +1362,7 @@
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Measurement.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="530">
|
||||
<caret line="114" column="21" lean-forward="true" selection-start-line="114" selection-start-column="21" selection-end-line="114" selection-end-column="21" />
|
||||
<caret line="114" column="21" lean-forward="false" selection-start-line="114" selection-start-column="21" selection-end-line="114" selection-end-column="21" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@@ -1391,28 +1375,10 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Database.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="725">
|
||||
<caret line="213" column="0" lean-forward="true" selection-start-line="213" selection-start-column="0" selection-end-line="213" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/CLScanner.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="750">
|
||||
<caret line="64" column="0" lean-forward="true" selection-start-line="64" selection-start-column="0" selection-end-line="64" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/FluidShot.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="540">
|
||||
<caret line="36" column="0" lean-forward="true" selection-start-line="36" selection-start-column="0" selection-end-line="36" selection-end-column="0" />
|
||||
<caret line="36" column="0" lean-forward="false" selection-start-line="36" selection-start-column="0" selection-end-line="36" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#304#305#0" expanded="true" />
|
||||
<element signature="e#343#344#0" expanded="true" />
|
||||
@@ -1424,10 +1390,55 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/CLScanner.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="750">
|
||||
<caret line="64" column="0" lean-forward="false" selection-start-line="64" selection-start-column="0" selection-end-line="64" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Database.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="105">
|
||||
<caret line="23" column="13" lean-forward="false" selection-start-line="23" selection-start-column="13" selection-end-line="23" selection-end-column="13" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/DigitalIn.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="525">
|
||||
<caret line="39" column="5" lean-forward="false" selection-start-line="39" selection-start-column="5" selection-end-line="39" selection-end-column="5" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/DigitalOut.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="600">
|
||||
<caret line="51" column="4" lean-forward="false" selection-start-line="51" selection-start-column="4" selection-end-line="51" selection-end-column="4" />
|
||||
<folding>
|
||||
<element signature="e#1307#1308#0" expanded="true" />
|
||||
<element signature="e#1335#1336#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/IOControl.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="614">
|
||||
<caret line="58" column="39" lean-forward="false" selection-start-line="58" selection-start-column="39" selection-end-line="58" selection-end-column="39" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Well.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="769">
|
||||
<caret line="763" column="33" lean-forward="true" selection-start-line="763" selection-start-column="33" selection-end-line="763" selection-end-column="33" />
|
||||
<state relative-caret-position="450">
|
||||
<caret line="48" column="37" lean-forward="true" selection-start-line="48" selection-start-column="37" selection-end-line="48" selection-end-column="37" />
|
||||
<folding>
|
||||
<element signature="e#11423#11424#0" expanded="true" />
|
||||
<element signature="e#11479#11480#0" expanded="true" />
|
||||
|
||||
3
www/pocwww/.coveragerc
Normal file
3
www/pocwww/.coveragerc
Normal file
@@ -0,0 +1,3 @@
|
||||
[run]
|
||||
source = pocwww
|
||||
omit = pocwww/test*
|
||||
4
www/pocwww/CHANGES.txt
Normal file
4
www/pocwww/CHANGES.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
0.0
|
||||
---
|
||||
|
||||
- Initial version.
|
||||
2
www/pocwww/MANIFEST.in
Normal file
2
www/pocwww/MANIFEST.in
Normal file
@@ -0,0 +1,2 @@
|
||||
include *.txt *.ini *.cfg *.rst
|
||||
recursive-include pocwww *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml *.jinja2
|
||||
29
www/pocwww/README.txt
Normal file
29
www/pocwww/README.txt
Normal file
@@ -0,0 +1,29 @@
|
||||
POC Web Interface
|
||||
===============================
|
||||
|
||||
Getting Started
|
||||
---------------
|
||||
|
||||
- Change directory into your newly created project.
|
||||
|
||||
cd POC Web Interface
|
||||
|
||||
- Create a Python virtual environment.
|
||||
|
||||
python3 -m venv env
|
||||
|
||||
- Upgrade packaging tools.
|
||||
|
||||
env/bin/pip install --upgrade pip setuptools
|
||||
|
||||
- Install the project in editable mode with its testing requirements.
|
||||
|
||||
env/bin/pip install -e ".[testing]"
|
||||
|
||||
- Run your project's tests.
|
||||
|
||||
env/bin/pytest
|
||||
|
||||
- Run your project.
|
||||
|
||||
env/bin/pserve development.ini
|
||||
62
www/pocwww/development.ini
Normal file
62
www/pocwww/development.ini
Normal file
@@ -0,0 +1,62 @@
|
||||
###
|
||||
# app configuration
|
||||
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
|
||||
###
|
||||
|
||||
[app:main]
|
||||
use = egg:pocwww
|
||||
|
||||
pyramid.reload_templates = true
|
||||
pyramid.debug_authorization = false
|
||||
pyramid.debug_notfound = false
|
||||
pyramid.debug_routematch = false
|
||||
pyramid.default_locale_name = en
|
||||
pyramid.includes =
|
||||
pyramid_debugtoolbar
|
||||
|
||||
# By default, the toolbar only appears for clients from IP addresses
|
||||
# '127.0.0.1' and '::1'.
|
||||
# debugtoolbar.hosts = 127.0.0.1 ::1
|
||||
|
||||
mongo_uri = mongodb://localhost:27017/poc
|
||||
|
||||
|
||||
###
|
||||
# wsgi server configuration
|
||||
###
|
||||
|
||||
[server:main]
|
||||
use = egg:waitress#main
|
||||
listen = *:6543
|
||||
|
||||
###
|
||||
# logging configuration
|
||||
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
|
||||
###
|
||||
|
||||
[loggers]
|
||||
keys = root, pocwww
|
||||
|
||||
[handlers]
|
||||
keys = console
|
||||
|
||||
[formatters]
|
||||
keys = generic
|
||||
|
||||
[logger_root]
|
||||
level = INFO
|
||||
handlers = console
|
||||
|
||||
[logger_pocwww]
|
||||
level = DEBUG
|
||||
handlers =
|
||||
qualname = pocwww
|
||||
|
||||
[handler_console]
|
||||
class = StreamHandler
|
||||
args = (sys.stderr,)
|
||||
level = NOTSET
|
||||
formatter = generic
|
||||
|
||||
[formatter_generic]
|
||||
format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s
|
||||
38
www/pocwww/pocwww/__init__.py
Normal file
38
www/pocwww/pocwww/__init__.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from pyramid.config import Configurator
|
||||
|
||||
try:
|
||||
# for python 2
|
||||
from urlparse import urlparse
|
||||
except ImportError:
|
||||
# for python 3
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from pymongo import MongoClient
|
||||
|
||||
|
||||
def main(global_config, **settings):
|
||||
""" This function returns a Pyramid WSGI application.
|
||||
"""
|
||||
config = Configurator(settings=settings)
|
||||
config.include('pyramid_jinja2')
|
||||
|
||||
db_url = urlparse(settings['mongo_uri'])
|
||||
config.registry.db = MongoClient(
|
||||
host=db_url.hostname,
|
||||
port=db_url.port,
|
||||
)
|
||||
|
||||
def add_db(request):
|
||||
db = config.registry.db[db_url.path[1:]]
|
||||
if db_url.username and db_url.password:
|
||||
db.authenticate(db_url.username, db_url.password)
|
||||
return db
|
||||
|
||||
config.add_request_method(add_db, 'db', reify=True)
|
||||
config.add_static_view('static', 'static', cache_max_age=3600)
|
||||
config.add_route('home', '/')
|
||||
config.add_route('cards_page', '/cards/{page_num}')
|
||||
config.add_route('cards', '/cards')
|
||||
config.add_route('card_single', "/card/view/{stroke_number}")
|
||||
config.scan()
|
||||
return config.make_wsgi_app()
|
||||
BIN
www/pocwww/pocwww/static/pyramid-16x16.png
Normal file
BIN
www/pocwww/pocwww/static/pyramid-16x16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
www/pocwww/pocwww/static/pyramid.png
Normal file
BIN
www/pocwww/pocwww/static/pyramid.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
121
www/pocwww/pocwww/static/theme.css
Normal file
121
www/pocwww/pocwww/static/theme.css
Normal file
@@ -0,0 +1,121 @@
|
||||
/*@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: #ffffff;
|
||||
background: #bc2131;
|
||||
}
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-weight: 300;
|
||||
}*/
|
||||
/*
|
||||
* Base structure
|
||||
*/
|
||||
|
||||
/* Move down content because we have a fixed navbar that is 50px tall */
|
||||
body {
|
||||
padding-top: 50px;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Global add-ons
|
||||
*/
|
||||
|
||||
.sub-header {
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
/*
|
||||
* Top navigation
|
||||
* Hide default border to remove 1px line.
|
||||
*/
|
||||
.navbar-fixed-top {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sidebar
|
||||
*/
|
||||
|
||||
/* Hide for mobile, show later */
|
||||
.sidebar {
|
||||
display: none;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.sidebar {
|
||||
position: fixed;
|
||||
top: 51px;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 1000;
|
||||
display: block;
|
||||
padding: 20px;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
|
||||
background-color: #f5f5f5;
|
||||
border-right: 1px solid #eee;
|
||||
}
|
||||
}
|
||||
|
||||
/* Sidebar navigation */
|
||||
.nav-sidebar {
|
||||
margin-right: -21px; /* 20px padding + 1px border */
|
||||
margin-bottom: 20px;
|
||||
margin-left: -20px;
|
||||
}
|
||||
.nav-sidebar > li > a {
|
||||
padding-right: 20px;
|
||||
padding-left: 20px;
|
||||
}
|
||||
.nav-sidebar > .active > a,
|
||||
.nav-sidebar > .active > a:hover,
|
||||
.nav-sidebar > .active > a:focus {
|
||||
color: #fff;
|
||||
background-color: #428bca;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Main content
|
||||
*/
|
||||
|
||||
.main {
|
||||
padding: 20px;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.main {
|
||||
padding-right: 40px;
|
||||
padding-left: 40px;
|
||||
}
|
||||
}
|
||||
.main .page-header {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Placeholder dashboard ideas
|
||||
*/
|
||||
|
||||
.placeholders {
|
||||
margin-bottom: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
.placeholders h4 {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.placeholder {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.placeholder img {
|
||||
display: inline-block;
|
||||
border-radius: 50%;
|
||||
}
|
||||
10
www/pocwww/pocwww/templates/cardlist.jinja2
Normal file
10
www/pocwww/pocwww/templates/cardlist.jinja2
Normal file
@@ -0,0 +1,10 @@
|
||||
{% extends "layout.jinja2" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="content">
|
||||
<h1>Card Data Page {{page_num}} / {{total_pages}}</h1>
|
||||
{% for card in cards %}
|
||||
<p><a href="/card/view/{{card.strokeNumber}}">{{card.timestamp}}</a></p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock content %}
|
||||
11
www/pocwww/pocwww/templates/cardsingle.jinja2
Normal file
11
www/pocwww/pocwww/templates/cardsingle.jinja2
Normal file
@@ -0,0 +1,11 @@
|
||||
{% extends "layout.jinja2" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="content">
|
||||
<pre>{{card.timestamp}}</pre>
|
||||
<pre>{{card.surface_position}}</pre>
|
||||
<pre>{{card.surface_load}}</pre>
|
||||
<pre>{{card.downhole_position}}</pre>
|
||||
<pre>{{card.downhole_load}}</pre>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
86
www/pocwww/pocwww/templates/layout.jinja2
Normal file
86
www/pocwww/pocwww/templates/layout.jinja2
Normal file
@@ -0,0 +1,86 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
<link rel="icon" href="../../favicon.ico">
|
||||
|
||||
<title>Henry POC</title>
|
||||
|
||||
<!-- BOOTSTRAP -->
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||
<!-- END BOOTSTRAP -->
|
||||
|
||||
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
|
||||
<link href="../../assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">
|
||||
|
||||
<!-- Custom styles for this scaffold -->
|
||||
<link href="{{request.static_url('pocwww:static/theme.css')}}" rel="stylesheet">
|
||||
|
||||
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
|
||||
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
|
||||
<script src="../../assets/js/ie-emulation-modes-warning.js"></script>
|
||||
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="#">Henry POC</a>
|
||||
</div>
|
||||
<div id="navbar" class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li><a href="/configuration">Configuration</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-3 col-md-2 sidebar">
|
||||
<ul class="nav nav-sidebar">
|
||||
<li class="active"><a href="/">Dashboard</a></li>
|
||||
<li><a href="/cards">Cards</a></li>
|
||||
<li><a href="/values">Values</a></li>
|
||||
<li><a href="/gaugeoff">Gauge-Off</a></li>
|
||||
</ul>
|
||||
<ul class="nav nav-sidebar">
|
||||
<li><a href="/fluidshots">Fluid Shots</a></li>
|
||||
<li><a href="/welltests">Well Tests</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
|
||||
{% block content %}
|
||||
<p>No content</p>
|
||||
{% endblock content %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Bootstrap core JavaScript
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
||||
<!-- Latest compiled and minified JavaScript -->
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
||||
</body>
|
||||
</html>
|
||||
8
www/pocwww/pocwww/templates/mytemplate.jinja2
Normal file
8
www/pocwww/pocwww/templates/mytemplate.jinja2
Normal file
@@ -0,0 +1,8 @@
|
||||
{% extends "layout.jinja2" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="content">
|
||||
<h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">Starter project</span></h1>
|
||||
<p class="lead">Welcome to <span class="font-normal">POC Web Interface</span>, a Pyramid application generated by<br><span class="font-normal">Cookiecutter</span>.</p>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
29
www/pocwww/pocwww/tests.py
Normal file
29
www/pocwww/pocwww/tests.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import unittest
|
||||
|
||||
from pyramid import testing
|
||||
|
||||
|
||||
class ViewTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.config = testing.setUp()
|
||||
|
||||
def tearDown(self):
|
||||
testing.tearDown()
|
||||
|
||||
def test_my_view(self):
|
||||
from .views import my_view
|
||||
request = testing.DummyRequest()
|
||||
info = my_view(request)
|
||||
self.assertEqual(info['project'], 'POC Web Interface')
|
||||
|
||||
|
||||
class FunctionalTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
from pocwww import main
|
||||
app = main({})
|
||||
from webtest import TestApp
|
||||
self.testapp = TestApp(app)
|
||||
|
||||
def test_root(self):
|
||||
res = self.testapp.get('/', status=200)
|
||||
self.assertTrue(b'Pyramid' in res.body)
|
||||
39
www/pocwww/pocwww/views.py
Normal file
39
www/pocwww/pocwww/views.py
Normal file
@@ -0,0 +1,39 @@
|
||||
from pyramid.view import view_config
|
||||
|
||||
from math import ceil
|
||||
|
||||
|
||||
@view_config(route_name='home', renderer='templates/mytemplate.jinja2')
|
||||
def my_view(request):
|
||||
return {'project': 'POC Web Interface'}
|
||||
|
||||
|
||||
def card_page(request):
|
||||
page_num = 1
|
||||
try:
|
||||
page_num = int(request.matchdict['page_num'])
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
num_per_page = 100
|
||||
num_cards = request.db['cards'].count()
|
||||
pages = ceil(num_cards / num_per_page)
|
||||
|
||||
cards = request.db['cards'].find().sort("timestamp", -1).skip(num_per_page * (page_num - 1)).limit(num_per_page)
|
||||
return {'cards': list(cards), 'page_num': page_num, 'total_pages': pages}
|
||||
|
||||
|
||||
@view_config(route_name='cards', renderer='templates/cardlist.jinja2')
|
||||
def cards(request):
|
||||
return card_page(request)
|
||||
|
||||
|
||||
@view_config(route_name='cards_page', renderer='templates/cardlist.jinja2')
|
||||
def cards_page(request):
|
||||
return card_page(request)
|
||||
|
||||
|
||||
@view_config(route_name='card_single', renderer='templates/cardsingle.jinja2')
|
||||
def card_single(request):
|
||||
card = list(request.db['cards'].find({"strokeNumber": int(request.matchdict['stroke_number'])}))
|
||||
return {"card": card[0]}
|
||||
53
www/pocwww/production.ini
Normal file
53
www/pocwww/production.ini
Normal file
@@ -0,0 +1,53 @@
|
||||
###
|
||||
# app configuration
|
||||
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
|
||||
###
|
||||
|
||||
[app:main]
|
||||
use = egg:pocwww
|
||||
|
||||
pyramid.reload_templates = false
|
||||
pyramid.debug_authorization = false
|
||||
pyramid.debug_notfound = false
|
||||
pyramid.debug_routematch = false
|
||||
pyramid.default_locale_name = en
|
||||
|
||||
###
|
||||
# wsgi server configuration
|
||||
###
|
||||
|
||||
[server:main]
|
||||
use = egg:waitress#main
|
||||
listen = *:6543
|
||||
|
||||
###
|
||||
# logging configuration
|
||||
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
|
||||
###
|
||||
|
||||
[loggers]
|
||||
keys = root, pocwww
|
||||
|
||||
[handlers]
|
||||
keys = console
|
||||
|
||||
[formatters]
|
||||
keys = generic
|
||||
|
||||
[logger_root]
|
||||
level = WARN
|
||||
handlers = console
|
||||
|
||||
[logger_pocwww]
|
||||
level = WARN
|
||||
handlers =
|
||||
qualname = pocwww
|
||||
|
||||
[handler_console]
|
||||
class = StreamHandler
|
||||
args = (sys.stderr,)
|
||||
level = NOTSET
|
||||
formatter = generic
|
||||
|
||||
[formatter_generic]
|
||||
format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s
|
||||
3
www/pocwww/pytest.ini
Normal file
3
www/pocwww/pytest.ini
Normal file
@@ -0,0 +1,3 @@
|
||||
[pytest]
|
||||
testpaths = pocwww
|
||||
python_files = *.py
|
||||
51
www/pocwww/setup.py
Normal file
51
www/pocwww/setup.py
Normal file
@@ -0,0 +1,51 @@
|
||||
import os
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
with open(os.path.join(here, 'README.txt')) as f:
|
||||
README = f.read()
|
||||
with open(os.path.join(here, 'CHANGES.txt')) as f:
|
||||
CHANGES = f.read()
|
||||
|
||||
requires = [
|
||||
'pyramid',
|
||||
'pyramid_jinja2',
|
||||
'pyramid_debugtoolbar',
|
||||
'waitress',
|
||||
]
|
||||
|
||||
tests_require = [
|
||||
'WebTest >= 1.3.1', # py3 compat
|
||||
'pytest',
|
||||
'pytest-cov',
|
||||
]
|
||||
|
||||
setup(
|
||||
name='pocwww',
|
||||
version='0.0',
|
||||
description='POC Web Interface',
|
||||
long_description=README + '\n\n' + CHANGES,
|
||||
classifiers=[
|
||||
'Programming Language :: Python',
|
||||
'Framework :: Pyramid',
|
||||
'Topic :: Internet :: WWW/HTTP',
|
||||
'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
|
||||
],
|
||||
author='',
|
||||
author_email='',
|
||||
url='',
|
||||
keywords='web pyramid pylons',
|
||||
packages=find_packages(),
|
||||
include_package_data=True,
|
||||
zip_safe=False,
|
||||
extras_require={
|
||||
'testing': tests_require,
|
||||
},
|
||||
install_requires=requires,
|
||||
entry_points={
|
||||
'paste.app_factory': [
|
||||
'main = pocwww:main',
|
||||
],
|
||||
},
|
||||
)
|
||||
Reference in New Issue
Block a user