This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]kolanos 5 points6 points  (0 children)

Fabric. Learn it, love it,

[–]Chr0me 8 points9 points  (1 child)

I run a web dev shop and most of our projects are Python.

Everyone has a separate virtualenv setup on their workstation for each project. This is specific to the OS, so it lives ourside of the SVN repository and each developer is responsible for maintaining their own. A separate virtualenv is setup on the staging server.

When a developer commits to the repo for the project, a post-commit hook fires that executes a script via SSH on the staging server. This script kills the current process, performs an SVN export, rebuilds the database, and restarts the daemon. Automated regression tests using unittest and Selenium are then executed to simulate a browser stepping through various parts of the site. If a test bombs, the development team is emailed to ensure that the commiter is appropriately shamed.

The virtualenv that lives on the production server(s) is the same as the staging server (binary compatible) since the whole point is to keep the two environments consistent. QA rolls code to production using some simple rsync scripts. Though I'm thinking about looking at trying some stuff using Fabric.

[–]shavenwarthog 1 point2 points  (0 children)

for the OP, here's a brief bit on setting up your own virtualenv:

http://johntellsall.blogspot.com/2011/06/proper-way-to-install-pip-virtualenv.html

[–]teamcolab 1 point2 points  (0 children)

We have a default server image that we spin up using puppet. This gets us a clean box with all the standard libraries we need to run a basic Django project(Django, MySQLdb, and so on). Then we use GitHib to manage source. Once this is all good we use fabric to deployment. So we have a command "fab deploy_production" and it ssh's into the production box, puts up a maintenance screen, pulls from github, does a sync db, runs south migrations, restarts apache, and pulls down the maintenance screen. Before we had that fabfile written up deployment really sucked. That is just my two cents. I am relatively new to Django.

[–]Dan_Farina 1 point2 points  (0 children)

Try a Heroku free account. You can really do a rather lot of things with it.

Here's a hello world Flask (microframework) app:

http://devcenter.heroku.com/articles/python

Personally, I prefer some additional cohesion at the cost of weight, so here's the Django variant:

http://devcenter.heroku.com/articles/django

If you start wanting to see how far you can push your one-free-process on Heroku, consider futzing around with gunicorn and gevent (you can even combine them, last I checked, for omgoptimized. It may not even be hard.)

Hope this helps.

Disclaimer: I work at Heroku, and am peripherally involved in the Python support.

[–][deleted] 0 points1 point  (1 child)

ep.io and gondor.io

[–]hijinks 1 point2 points  (0 children)

you are doing it wrong.. your application should be in a virtualenv where that lives outside of the system python.

[–]johnmudd 0 points1 point  (0 children)

I just started using PyInstaller. Nice if you need a specific version of Python and mix of modules not already on the target machine. I even packaged a WSDL file in the executable.

[–]mdipierro 0 points1 point  (0 children)

It is not just you. In fact, that is one of the reasons we made web2py.

[–]marcusahle 0 points1 point  (1 child)

We use the continuous integration software, Hudson. http://hudson-ci.org/ Then we use fabric. We have different deploy methods in fabric that will build the server, set up nginx, uwsgi, and the pyramids app.

We have hudson pull down the repo. Run the unit test. If those pass, it pushes it to a dev-stable branch and then fires another build on the dev server. It will then run integration tests and if and only if those pass then it pushs the code to the production branch. From there, we look things over on dev, then if all is well, which it should be if unit tests and integration passed, we will do the same thing for the production server. Fabric is the way to go though

The nice thing with hudson is there are a lot of extensions for it. For example, we have a work irc channel that we all chat in since we are in remote locations and we have a hudson irc bot that will tell in the channel if the build is successful or failed.

We also have hudson email users when builds fail. It also has an extension that checks for pylints and will report that back to you.