Django/Python apps and prerequisites for developer environment
Currently my Dj开发者_JS百科ango project has a huge readme doc, that any developer, whishing to work on the source, must follow to setup their development environment.
It goes something like this:
Prerequisites:
- Django Css. See Django CSS.
- CleverCSS. See Clever CSS.
- Beautiful Soup. See Beautiful Soup.
- Dateutil. See python-dateutil.
- httplib2 http://code.google.com/p/httplib2/
- python-oauth2 https://github.com/simplegeo/python-oauth2
- python-twitter http://code.google.com/p/python-twitter/
Is there any facility for writting some sort of script that will fetch the dependencies automatically? At least to automate this process partially to something like:
python setup_environment.py
I've looked at setuptools - but it seems to me that it is more for the purpose of installing the app itself onto the system, not fulfilling the developer's requirements for environment setup.
Will pip not do the job?
http://www.pip-installer.org/en/latest/index.html#
You can freeze all requirements on your server to a file (run this on the server):
pip freeze > REQUIREMENTS.txt
and then on your dev environment:
pip install -r ./REQUIREMENTS.txt
to install everything listed in the REQUIREMENTS file.
You should also look at installing virtualenv (and virtualenvwrapper) as well on your development (and production) server
http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
They allow you to set up multiple encapsulated python environments. This means you can have two django apps set up on the same machine, each with different python versions/python applications/django versions.
You also require specific versions of each of these - the ones you built and tested your application against.
But they're all just python modules - ie uncompiled text files. You can put them all with your source such that when they get your code they get all these exact dependencies at the same time. Set pythonpath and you're done.
Works just so long as the package is pure python. Any C libs lurking in there and you're probably back to pip/setuptools/apt/easy - "lxml" i'm talking about you.
精彩评论