This is sample code used in the Real Python article [Writing an Installable Django App](???). The article describes how to take an app from an existing Django project and make it a stand-alone installable package avilable on PyPI.
Installable App
This app models a list of items on a receipt. Each item has a description and a cost. A receipt may reference multiple items.
This app can be installed and used in your django project by:
$ pip install realpython-django-receipts
Edit your settings.py file to include ‘receipts’ in the INSTALLED_APPS listing.
INSTALLED_APPS = [
...
'receipts',
]
Edit your project urls.py file to import the URLs:
url_patterns = [
...
path('receipts/', include('receipts.urls')),
]
Finally, add the models to your database:
$ ./manage.py makemigrations receipts
The “project” Branch
The master branch contains the final code for the PyPI package. There is also a project branch which shows the “before” case – the Django project before the app has been removed.
Docs & Source
Release files for django-installable-skeleton 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-installable-skeleton-1.0.0.tar.gz | 2.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_installable_skeleton-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:4.3 kB
Release files / django-installable-skeleton-1.0.0.tar.gz
| Download URL | django-installable-skeleton-1.0.0.tar.gz |
|---|---|
| Size | 2.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72eccb3c708802a070697edf02571149818b8f58641cfc2155d1e12f93a85fd8
|
|
BLAKE2b-256 checksum How to use checksums |
094c7acad755484d0d17e783fff9386c3c0c418e53a59995650fb61caecf8cc9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / django_installable_skeleton-1.0.0-py3-none-any.whl
| Download URL | django_installable_skeleton-1.0.0-py3-none-any.whl |
|---|---|
| Size | 2.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be2456a3a8c7e7ee1249943ebfce1122685976e536d480b78e0b414645906833
|
|
BLAKE2b-256 checksum How to use checksums |
224aed0312aa322989b22e0e94f040d6aa1c5238f0b2d6e8df8f335c66db95f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|