Sample installable django app
Project description
This is the sample code used in the Real Python article How to Write 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 available 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 with:
$ 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 “before” project
The before folder shows the “before” case – the Django project before the app was made installable.
Docs & Source
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file realpython_django_receipts-1.1.0.tar.gz.
File metadata
- Download URL: realpython_django_receipts-1.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40bd8e99b1261b523c5bf87e21626acefd030adc4d23d3238e8c863ebdfe3ca3
|
|
| MD5 |
902361fd54b5d4f7ad133a771a738a57
|
|
| BLAKE2b-256 |
95eb3dc56f90b6cf5a144f5916dc5caf29e8e06c17f2e752d2c0d8dfd5618c7e
|
File details
Details for the file realpython_django_receipts-1.1.0-py3-none-any.whl.
File metadata
- Download URL: realpython_django_receipts-1.1.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
734a31abc5a99f472be07a7d759596a41c7a2e7e538aa887156cc121d4639a1f
|
|
| MD5 |
093fb252c889047fa72fd1022a08f1c9
|
|
| BLAKE2b-256 |
732aff20388e9546c5f1a99b63dcafacf67a0c7af433bc145c2e6d3276fa04a3
|