Last active
July 9, 2018 16:24
-
-
Save jackdesert/52db46f680c9e76b0c85ddb55b3e03ab to your computer and use it in GitHub Desktop.
WSGI endpoing for pyramid app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# project is named "stethoscope" | |
# project was built from pyramid-cookiecutter-alchemy | |
############################################################## | |
# Here are the contents of stethoscope/stethoscope/__init__.py | |
############################################################## | |
from pyramid.config import Configurator | |
import pdb | |
def main(global_config, **settings): | |
""" This function returns a Pyramid WSGI application. | |
""" | |
config = Configurator(settings=settings) | |
config.add_renderer(name='.md', factory='.renderers.markdown.MarkdownRenderer') | |
config.include('pyramid_jinja2') | |
config.include('.models') | |
config.include('.routes') | |
config.scan() | |
return config.make_wsgi_app() | |
######################################################################### | |
# So I was assuming the entry point (wsgi.py file) should look like this: | |
######################################################################### | |
from stethoscope import main | |
#################################################################### | |
# Invoking as: | |
# sudo uwsgi --chmod-socket=020 --enable-threads --plugin=python3 -s tmp/stethoscope.sock --manage-script-name --mount /=wsgi:main --uid ubuntu --gid www-data --virtualenv env | |
# I get these errors: | |
TypeError: main() takes 1 positional argument but 2 were given | |
[pid: 20714|app: 0|req: 2/2] 127.0.0.1 () {32 vars in 366 bytes} [Mon Jul 9 09:19:28 2018] GET / => generated 0 bytes in 0 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0) | |
############################################ | |
# But what do I pass in for "global_config"? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment