Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Kiste
studfeed
Commits
41e0ae64
Commit
41e0ae64
authored
Nov 10, 2017
by
Kiste
Browse files
Proper FastCGI support
parent
f5bd9cc0
Changes
3
Hide whitespace changes
Inline
Side-by-side
config.json
0 → 100644
View file @
41e0ae64
{
"user"
:
"username"
,
"password"
:
"secretpassphrase"
}
setup.py
View file @
41e0ae64
...
...
@@ -15,6 +15,9 @@ setup(
'feedgen'
,
'requests'
],
extras_require
=
{
'FastCGI support'
:
[
'flipflop'
]
},
entry_points
=
{
'console_scripts'
:
[
'studfeed = studfeed.studfeed:main'
...
...
studfeed
/wsgi.py
→
studfeed
.fcgi
View file @
41e0ae64
#!/path/to/python3
# -*- coding: utf-8 -*-
from
.studfeed
import
generate_feed
import
json
from
studfeed.studfeed
import
generate_feed
from
flipflop
import
WSGIServer
USER
=
''
PASSWORD
=
''
CONFIGPATH
=
'/path/to/config.json'
def
application
(
environ
,
start_response
):
try
:
feed
=
generate_feed
(
USER
,
PASSWORD
).
atom_str
()
feed
=
generate_feed
(
config
[
'user'
],
config
[
'password'
]
).
atom_str
()
except
:
start_response
(
'500 Internal Server Error'
,
[(
'Content-Type'
,
'text/plain'
)])
return
[]
start_response
(
'200 OK'
,
[(
'Content-Type'
,
'application/atom+xml'
),
(
"Content-Length"
,
str
(
len
(
feed
)))])
return
[
feed
]
with
open
(
CONFIGPATH
)
as
configfile
:
config
=
json
.
load
(
configfile
)
WSGIServer
(
application
).
run
()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment