-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_app.py
More file actions
59 lines (46 loc) · 1.59 KB
/
test_app.py
File metadata and controls
59 lines (46 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import os
from time import sleep
from flask import Flask, render_template, Response,redirect
import yaml
from datetime import datetime
from configparser import ConfigParser
import logging
from pathlib import Path
# from deepi import WebSocketStream
# from deepi import VideoRecorder, StillCamera
webapp_path = os.path.join(os.path.dirname(__file__),'deepi','webapp')
template_dir = os.path.join(webapp_path,'templates')
static_dir = os.path.join(webapp_path,'static')
# template_dir = os.path.abspath('templates/')
# static_dir = os.path.abspath('static/')
logging.debug("Building flask app")
app = Flask(__name__,
static_url_path='',
static_folder=static_dir,
template_folder=template_dir)
@app.route('/')
def index():
return render_template('index.html',wsport=8000)
@app.route('/stream/')
def stream_only():
return render_template('stream.html',wsport=8000)
# Config
logging.debug("Reading config file")
# config = DEEPiConfig()
# logpath = Path(config.get('ALL','logpath'))
loglevel = logging.DEBUG # TODO: get to work with config file
logging.basicConfig(format='%(levelname)s: %(message)s',
level=logging.DEBUG)
logging.debug("Reading config file")
logging.info('Initializing camera')
# picam = load_camera(config)
# Set up cameras
# stillcam = make_camera(picam, config)
# recorder = make_recorder(picam, config)
# streamer = make_web_streamer(picam, config)
# Lights
logging.debug("Starting lights")
# pin_num = config.getint('LIGHTS', 'gpio')
# lights = LightController(pin_num)
# Generate app
app.run(host='0.0.0.0',port=8080,debug=False)