Skip to main content

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

realpython_django_receipts-1.1.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file realpython_django_receipts-1.1.0.tar.gz.

File metadata

File hashes

Hashes for realpython_django_receipts-1.1.0.tar.gz
Algorithm Hash digest
SHA256 40bd8e99b1261b523c5bf87e21626acefd030adc4d23d3238e8c863ebdfe3ca3
MD5 902361fd54b5d4f7ad133a771a738a57
BLAKE2b-256 95eb3dc56f90b6cf5a144f5916dc5caf29e8e06c17f2e752d2c0d8dfd5618c7e

See more details on using hashes here.

File details

Details for the file realpython_django_receipts-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for realpython_django_receipts-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 734a31abc5a99f472be07a7d759596a41c7a2e7e538aa887156cc121d4639a1f
MD5 093fb252c889047fa72fd1022a08f1c9
BLAKE2b-256 732aff20388e9546c5f1a99b63dcafacf67a0c7af433bc145c2e6d3276fa04a3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page