Created
December 7, 2016 10:17
-
-
Save zupo/40e60896464852d4e4177acf77a7f206 to your computer and use it in GitHub Desktop.
example 1
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
""" | |
* Put this code into home.py | |
* Install Pyramid. | |
* Run ``$ python home.py``. | |
* Point your browser to http://localhost:8080/ | |
""" | |
from wsgiref.simple_server import make_server | |
from pyramid.config import Configurator | |
from pyramid.response import Response | |
from pyramid.view import view_config | |
@view_config( | |
route_name='home' | |
) | |
def home(request): | |
return Response('Welcome!') | |
if __name__ == '__main__': | |
config = Configurator() | |
config.add_route('home', '/') | |
config.scan() | |
app = config.make_wsgi_app() | |
server = make_server('0.0.0.0', 8080, app) | |
server.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment