Cleanup web views and mention settings.ini in README.md
This commit is contained in:
parent
d8655bf42e
commit
5948dceba7
|
@ -13,6 +13,11 @@ export VENV=/path/to/venv
|
||||||
python3 -m venv $VENV
|
python3 -m venv $VENV
|
||||||
$VENV/bin/pip install -e .
|
$VENV/bin/pip install -e .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
##Adapt the configuration
|
||||||
|
Check the contents of `settings.ini` to define what interface the service shall bind to.
|
||||||
|
Also location for files and the shelve database can be configured in there.
|
||||||
|
|
||||||
##Run the application
|
##Run the application
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -8,37 +8,3 @@ from pyramid.view import view_config
|
||||||
@view_config(route_name='home', renderer='templates/home.jinja2')
|
@view_config(route_name='home', renderer='templates/home.jinja2')
|
||||||
def home_view(request):
|
def home_view(request):
|
||||||
return dict()
|
return dict()
|
||||||
# This is how params can be passed to the renderer
|
|
||||||
#return dict(name=request.matchdict['name'])
|
|
||||||
|
|
||||||
"""
|
|
||||||
# /howdy?name=alice which links to the next view
|
|
||||||
@view_config(route_name='hello')
|
|
||||||
def hello_view(request):
|
|
||||||
name = request.params.get('name', 'No Name')
|
|
||||||
body = '<p>Hi %s, this <a href="/goto">redirects</a></p>'
|
|
||||||
# cgi.escape to prevent Cross-Site Scripting (XSS) [CWE 79]
|
|
||||||
return Response(body % cgi.escape(name))
|
|
||||||
|
|
||||||
|
|
||||||
# /goto which issues HTTP redirect to the last view
|
|
||||||
@view_config(route_name='redirect')
|
|
||||||
def redirect_view(request):
|
|
||||||
return HTTPFound(location="/problem")
|
|
||||||
|
|
||||||
|
|
||||||
# /problem which causes a site error
|
|
||||||
@view_config(route_name='exception')
|
|
||||||
def exception_view(request):
|
|
||||||
raise Exception()
|
|
||||||
|
|
||||||
# /get which shows a file by its uuid
|
|
||||||
@view_config(route_name='get_file')
|
|
||||||
def get_file_view(request):
|
|
||||||
body = 'Param: $(uuid)' % request.matchdict
|
|
||||||
return Response(body)
|
|
||||||
|
|
||||||
view_config(route_name='home', renderer='json')
|
|
||||||
def hello_json(request):
|
|
||||||
return [1, 2, 3]
|
|
||||||
"""
|
|
||||||
|
|
Loading…
Reference in New Issue