Why avoid CGI for Python with LAMP hosting?

前端 未结 6 532
春和景丽
春和景丽 2021-01-31 04:52

I have been using PHP for years. Lately I\'ve come across numerous forum posts stating that PHP is outdated, that modern programming languages are easier, more

6条回答
  •  情话喂你
    2021-01-31 05:19

    Why is it that using CGI is not the best way to use Python?

    I will stick up for CGI a little. It's good for development environments.

    It's simple to wire up and you don't have to worry about module reloading problems. Naturally performance is terrible, but for dev you don't care.

    Of course you should really be writing to the WSGI interface rather than CGI directly. You can then deploy through CGI using:

    wsgiref.handlers.CGIHandler().run(application)
    

    and use the same application object to deploy through mod_wsgi other whatever other WSGI server you prefer in the production environment where speed matters (and the testing environment where you want it to be as close to production as possible).

提交回复
热议问题