7

How can i package a project so that i can just call some function that runs the project?

I know how to package a django app, but my question is how to package a django project.

Currently i have my project on an internal pypi server and can pull it down using:

pip install [project]

but then to use it i have to go into my site-packages and then the package just so i can run

./manage.py ....

Or am i just better off checking out the project and pip installing the apps?

Calum
  • 2,110
  • 2
  • 22
  • 39
  • Are you trying to deploy to a production environment? – asthasr Jan 31 '13 at 04:16
  • yes i will be, currently im just testing deployment in a virtual enviroment – Calum Jan 31 '13 at 04:18
  • Have you read about wsgi? https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/ – asthasr Jan 31 '13 at 04:20
  • I am using [gunicorn](https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/gunicorn/) instead of wsgi (due to the fact gunicorn handles asynch workers), but as it says (if im reading it right) is you need to give a full path. I run it using './manage.py run_gunicorn ....' – Calum Jan 31 '13 at 04:27
  • Hmm. I guess I misunderstood the question a bit, in that I thought you wanted to automate the launch of the app (in production, manage.py is pretty irrelevant). In our projects we typically have a chef script check out the code, pip install dependencies, and then run uwsgi pointed (with full path) to the checkout location. – asthasr Jan 31 '13 at 04:31
  • thats what im thinking i may have to do, just check out the project, im just wondering if i could pip install it – Calum Jan 31 '13 at 05:08

3 Answers3

2

One way, is to create a package using your distros package management system. At my shop, we use Ubuntu's aptitude. So package our software as a .deb using CMake.

Gourneau
  • 12,660
  • 8
  • 42
  • 42
0

It's probably not the best way to do it, but you can use distribute to generate wrapper scripts for you: http://packages.python.org/distribute/setuptools.html#automatic-script-creation

Thomas
  • 11,757
  • 4
  • 41
  • 57
0

I had this same question with my own project. The solution, as the community around the project arrived at, was to package it in a number of ways for different platforms, but not as a PyPi module.

In order of popularity, my project is typically installed via:

  • Docker instance: docker pull <project-name> && docker-compose up
  • Cloning the git repo: git clone <url> && ./project/scripts/do-the-thing
  • Vagrant: vagrant up

If there was more support in the group, I suppose it would make sense to roll out a .deb, .ebuild, and .rpm, but at this stage, people seem more-or-less happy with the above.

Daniel Quinn
  • 6,010
  • 6
  • 38
  • 61