This project produces server-rendered HTML pages for the USGS Pubs Warehouse.
- Create a virtualenv and install the project's Python requirements.
virtualenv --python=python3.6 env
env/bin/pip install -r requirements.txt
- To override any Flask configuration parameters, modify
instance/config.py
. These will override any values in the project'sconfig.py
. There is a sample available:
mkdir -p instance
cp config.py.sample instance/config.py
To run the Flask development server at http://localhost:5050:
env/bin/python run.py
This app has Lettuce tests and Python unit tests. To run the Lettuce tests do the following with your virtualenv activated or using the full path name to Lettuce:
env/bin/lettuce --with-xunit pubs_ui/lettuce_testing
To run the unit tests do the following with your virtualenv activated or using the full path name to nosetests:
nosetests -w pubs_ui
If you want to generate a real secret key, you can do so trivially from the Python console by using os.urandom()
like so:
>>> import os
>>> os.urandom(24)
'\xa1\x89D\x9e+\xb4Pl\xbfr\xa5\xc3\xc1\x05\x9c\x90\x91\x10\xa8\xfa\x10\xe7r\x9e'
You can paste the generated string right into your SECRET_KEY global constant
On Mac OS, you may have trouble with the proxy to the pubs-services raising the following error:
SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:590)
You can solve this by pip install requests[security] but then the lettuce tests fail with:
raise SSLError(e, request=request)
SSLError: ('bad handshake: WantWriteError()',)