Preparing a pyramid app for production

混江龙づ霸主 提交于 2019-12-21 02:53:20

问题


So as I near the production phase of my web project, I've been wondering how exactly to deploy a pyramid app. In the docs, it says to use ../bin/python setup.py develop to put the app in development mode. Is there another mode that is designed for production. Or do I just use ../bin/python setup.py install.


回答1:


Well the big difference between python setup.py develop and python setup.py install. Is that install will install the package in your site-packages directory. While develop will install an egg-link that point to the directory for development.

So yeah you can technically use both method. But depending on how you did your project, installing in site-package might be a bad idea.

Why? FileUpload or anything your app might generate like dynamic files etc... If your app doesn't use config files to find where to save your files. Installing your app and running your app may try to write file in your site-packages directory.

In other words, you have to make sure that all files and directories that may be generated, etc can be located using config files.

Then if all dynamic directories are pointed out in the configs, then installing is good...

All you'll have to do is create a folder with a production.ini file and run pserve production.ini.

Code can be saved anywhere on your comp that way and you can also use uWSGI or any other WSGI server you like.

I think installing the code isn't a bad thing, and having data appart from the application is a good thing.

It has some advantage for deployment I guess.



来源:https://stackoverflow.com/questions/11894210/preparing-a-pyramid-app-for-production

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!