Skip to content

Commit

Permalink
urnresolver (#13), EticaAI/forum#94: Python Falcon works
Browse files Browse the repository at this point in the history
  • Loading branch information
fititnt committed Apr 30, 2021
1 parent 9df7668 commit c4bc114
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
6 changes: 6 additions & 0 deletions urn-data/urn-resolver-http/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# https://www.phusionpassenger.com/library/config/apache/reference/#passengerpython
# https://stackoverflow.com/questions/2842336/how-can-i-tell-phusion-passenger-which-python-to-use
# https://help.dreamhost.com/hc/en-us/articles/216635268-Passenger-troubleshooting
# PassengerPython /home/urneticaai/venv/bin/python3 # This would point to python (that is python2.7)
PassengerPython /home/urneticaai/opt/python-3.9.4/bin/python3.9
PassengerFriendlyErrorPages on
12 changes: 9 additions & 3 deletions urn-data/urn-resolver-http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@


```bash
cd urn-data/urn-resolver-http || exit
# cd urn-data/urn-resolver-http || exit

rsync --archive --verbose passenger_wsgi.py [email protected]:/home/urneticaai/urn.etica.ai/passenger_wsgi.py
rsync --archive --verbose things.py [email protected]:/home/urneticaai/urn.etica.ai/things.py
# rsync --archive --verbose passenger_wsgi.py [email protected]:/home/urneticaai/urn.etica.ai/passenger_wsgi.py
# rsync --archive --verbose things.py [email protected]:/home/urneticaai/urn.etica.ai/things.py

rsync --archive --verbose urn-data/urn-resolver-http/ [email protected]:/home/urneticaai/urn.etica.ai/

```

Expand All @@ -27,8 +28,13 @@ source venv/bin/activate
(venv) $ touch /home/urneticaai/tmp/restart.txt
(venv) $ tail logs/urn.etica.ai/http/error.log

## Logs
tail -f /home/urneticaai/logs/urn.etica.ai/http/error.log
tail -f /home/urneticaai/logs/urn.etica.ai/http/access.log

# @see https://help.dreamhost.com/hc/en-us/articles/215317698-Django-troubleshooting
(venv) $ pkill python3
(venv) $ touch /home/urneticaai/urn.etica.ai/passenger_wsgi.py
(venv) $ touch /home/urneticaai/tmp/restart.txt
(venv) $ touch /home/urneticaai/urn.etica.ai/tmp/restart.txt
```
16 changes: 11 additions & 5 deletions urn-data/urn-resolver-http/passenger_wsgi.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
"""urn-data/urn-resolver-http/passenger_wsgi.py
FILE: /home/urneticaai/urn.etica.ai/passenger_wsgi.py
Expand All @@ -8,17 +9,21 @@
# import os, sys
import os
import sys
import falcon
import things
# import falcon
# import things

print (sys.version)

# Virtual Env
INTERP = os.path.join(os.environ['HOME'], 'urn.etica.ai', 'venv', 'bin', 'python3')
# INTERP = os.path.join(os.environ['HOME'], 'urn.etica.ai', 'venv', 'bin', 'python')
INTERP = "/home/urneticaai/venv/bin/python"
if sys.executable != INTERP:
print (sys.version)
os.execl(INTERP, INTERP, *sys.argv)

# Let's get this party started
# import falcon
# import things
import falcon
import things

# falcon.API instances are callable WSGI apps
api = application = falcon.API()
Expand All @@ -28,3 +33,4 @@

# things will handle all requests to the '/things' URL path
api.add_route('/things', things_res)

1 change: 1 addition & 0 deletions urn-data/urn-resolver-http/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/EticaAI/HXL-Data-Science-file-formats/issues/13
3 changes: 2 additions & 1 deletion urn-data/urn-resolver-http/things.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ def on_get(self, req, resp):
resp.body = ('\nTwo things awe me most, the starry sky '
'above me and the moral law within me.\n'
'\n'
' ~ Immanuel Kant\n\n')
' ~ Immanuel Kant\n\n')

0 comments on commit c4bc114

Please sign in to comment.