Auto-detect the location of www/
Either ../www or /usr/share/morss Adapted README accordinglymaster
parent
39b0a1d7cc
commit
59139272fd
15
README.md
15
README.md
|
@ -144,17 +144,12 @@ Running this command should do:
|
||||||
uwsgi --http :9090 --plugin python --wsgi-file main.py
|
uwsgi --http :9090 --plugin python --wsgi-file main.py
|
||||||
```
|
```
|
||||||
|
|
||||||
However, one problem might be how to serve the provided `index.html` file if it
|
|
||||||
isn't in the same directory. Therefore you can add this at the end of the
|
|
||||||
command to point to another directory `--pyargv '--root ../../www/'`.
|
|
||||||
|
|
||||||
|
|
||||||
#### Using morss' internal HTTP server
|
#### Using morss' internal HTTP server
|
||||||
|
|
||||||
Morss can run its own HTTP server. The later should start when you run morss
|
Morss can run its own HTTP server. The later should start when you run morss
|
||||||
without any argument, on port 8080.
|
without any argument, on port 8080.
|
||||||
|
|
||||||
You can change the port and the location of the `www/` folder like this `python -m morss 9000 --root ../../www`.
|
You can change the port like this `python -m morss 9000`.
|
||||||
|
|
||||||
#### Passing arguments
|
#### Passing arguments
|
||||||
|
|
||||||
|
@ -174,9 +169,9 @@ Works like a charm with [Tiny Tiny RSS](http://tt-rss.org/redmine/projects/tt-rs
|
||||||
|
|
||||||
Run:
|
Run:
|
||||||
```
|
```
|
||||||
python[2.7] -m morss [argwithoutvalue] [argwithvalue=value] [...] FEEDURL
|
morss [argwithoutvalue] [argwithvalue=value] [...] FEEDURL
|
||||||
```
|
```
|
||||||
For example: `python -m morss debug http://feeds.bbci.co.uk/news/rss.xml`
|
For example: `morss debug http://feeds.bbci.co.uk/news/rss.xml`
|
||||||
|
|
||||||
*(Brackets indicate optional text)*
|
*(Brackets indicate optional text)*
|
||||||
|
|
||||||
|
@ -189,9 +184,9 @@ scripts can be run on top of the RSS feed, using its
|
||||||
|
|
||||||
To use this script, you have to enable "(Unix) command" in liferea feed settings, and use the command:
|
To use this script, you have to enable "(Unix) command" in liferea feed settings, and use the command:
|
||||||
```
|
```
|
||||||
[python[2.7]] PATH/TO/MORSS/main.py [argwithoutvalue] [argwithvalue=value] [...] FEEDURL
|
morss [argwithoutvalue] [argwithvalue=value] [...] FEEDURL
|
||||||
```
|
```
|
||||||
For example: `python2.7 PATH/TO/MORSS/main.py http://feeds.bbci.co.uk/news/rss.xml`
|
For example: `morss http://feeds.bbci.co.uk/news/rss.xml`
|
||||||
|
|
||||||
*(Brackets indicate optional text)*
|
*(Brackets indicate optional text)*
|
||||||
|
|
||||||
|
|
|
@ -620,13 +620,12 @@ def cgi_file_handler(environ, start_response, app):
|
||||||
if url == '':
|
if url == '':
|
||||||
url = 'index.html'
|
url = 'index.html'
|
||||||
|
|
||||||
if '--root' in sys.argv[1:]:
|
paths = [os.path.join(sys.prefix, 'share/morss', url),
|
||||||
path = os.path.join(sys.argv[-1], url)
|
os.path.join(os.path.dirname(__file__), '../www', url)]
|
||||||
|
|
||||||
else:
|
|
||||||
path = url
|
|
||||||
|
|
||||||
|
for path in paths:
|
||||||
try:
|
try:
|
||||||
|
print(path)
|
||||||
body = open(path, 'rb').read()
|
body = open(path, 'rb').read()
|
||||||
|
|
||||||
headers['status'] = '200 OK'
|
headers['status'] = '200 OK'
|
||||||
|
@ -635,6 +634,10 @@ def cgi_file_handler(environ, start_response, app):
|
||||||
return [body]
|
return [body]
|
||||||
|
|
||||||
except IOError:
|
except IOError:
|
||||||
|
continue
|
||||||
|
|
||||||
|
else:
|
||||||
|
# the for loop did not return, so here we are, i.e. no file found
|
||||||
headers['status'] = '404 Not found'
|
headers['status'] = '404 Not found'
|
||||||
start_response(headers['status'], list(headers.items()))
|
start_response(headers['status'], list(headers.items()))
|
||||||
return ['Error %s' % headers['status']]
|
return ['Error %s' % headers['status']]
|
||||||
|
@ -762,7 +765,7 @@ def main():
|
||||||
|
|
||||||
wsgiref.handlers.CGIHandler().run(app)
|
wsgiref.handlers.CGIHandler().run(app)
|
||||||
|
|
||||||
elif len(sys.argv) <= 1 or isInt(sys.argv[1]) or '--root' in sys.argv[1:]:
|
elif len(sys.argv) <= 1 or isInt(sys.argv[1]):
|
||||||
# start internal (basic) http server
|
# start internal (basic) http server
|
||||||
|
|
||||||
if len(sys.argv) > 1 and isInt(sys.argv[1]):
|
if len(sys.argv) > 1 and isInt(sys.argv[1]):
|
||||||
|
|
Loading…
Reference in New Issue