web.py with 1and1 shared hosting

15 просмотров
Перейти к первому непрочитанному сообщению

Mark Dowdy

не прочитано,
31 дек. 2017 г., 20:17:5731.12.2017
– web.py
Perhaps I don't understand what's going on in the Apache installation examples (well, I definitely don't, software development is old hat but web development is new) but I couldn't get any of them working. After more Google searches than I can count, and much teeth gnashing, I finally got the tutorial working on 1&1's shared hosting platform. In hopes of saving others some work in the future, here's my code.py file.

#!/usr/bin/env python

import wsgiref.handlers
import web

urls = (
    '/', 'index',
)

class index:
    def GET(self):
        return "Hello, world!"

if __name__ == "__main__":
    app = web.application(urls, globals())
    application = app.wsgifunc()
    wsgiref.handlers.CGIHandler().run(application)

No .htaccess file was needed. Note that this may not be appropriate for larger sites since this is serving WSGI via CGI. My site is smaller so it should be OK for me. Hope this saves someone some time in the future.

Ответить всем
Отправить сообщение автору
Переслать
0 новых сообщений