How to create a reusable package and distribute it with PIP



This article is an overview of the basic process to help to create a general purpose Django app and use it with PIP.

1. Code

Create the app with /original-project$ python startapp my_new_app in an existing project, then move it to a new directory separated from the project lik /django-new-app.

More at

Add tests as a new app in django-new-app.

So we have:

	- my-new-app
	- tests

Have a look at a popular Django app to see how they structure the project, like django-filter:

2. Package

To use it in original-project, we need to package the application (building a source distribution[^source-dist] for your package) with

After you are able to create the package with ``python3.8 sdistyou will have a compressed file (**Built Distribution**[^built-dist]) indjango-new-app/dist` To include non module files, create a file. 1

Handle dependencies

3. Use it

In our original-project now we can use it with python -m pip install /django-new-app/ or add --user if you are not already using a virtual environment.

4. Publish to (Optional)



  1. ↩︎

Marcelo Canina
I'm Marcelo Canina, a developer from Uruguay. I build websites and web-based applications from the ground up and share what I learn here.
comments powered by Disqus

Steps to create an app in Django, use it with pip, and publishing to pypi

Clutter-free software concepts.
Translations English Espa簽ol

Except as otherwise noted, the content of this page is licensed under CC BY-NC-ND 4.0 . Terms and Policy.

Powered by SimpleIT Hugo Theme