Packaging Stand-Alone Django Apps

From Littledamien Wiki
Revision as of 22:55, 23 March 2015 by Video8 (talk | contribs) (Created page with "category:Django Category:Python Category:Web Development == Directory structure == The app goes in a directory outside of any Django web project. If the app is `a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Directory structure

The app goes in a directory outside of any Django web project. If the app is addresses, structure it littled-addresses/addresses/.[1]

Try to avoid naming conflicts, of course. (Check resources like PyPI.)

Building the package

$ python setup.py sdist
  • Run from the package root directory.
  • Creates a dist directory which contains the (zipped) package.

Using the package

$ pip install --user django-addresses/dist/django-addresses-0.1.tar.gz

This installs the package on a system as a user library.

It can now be referenced in other Django projects.

Uninstalling the package

$ pip uninstall django-addresses

Notes

  1. How to Write Reusable Apps (Django documentation)