Skip to main content

A Python library that enables you to harness the power of Django's ORM in standalone Python scripts.

Project description

standalorm

A Python library that enables you to harness the power of Django's ORM in standalone Python scripts.

Installation

$ pip install standalorm

Usage

Getting started with standalorm is quick and easy.

  1. Create a Django app in your project's root directory:

    $ standalorm startapp
    
  2. Create your models in app-directory/models.py:

    from django.db import models
    
    # For demonstration purposes only.
    class ExampleModel(models.Model):
        exampleField = models.Field()
    
  3. Make and apply your migrations:

    $ standalorm makemigrations
    
    $ standalorm migrate
    
  4. Import the orm_init() function into your code and call it with the dunder variable __file__ as its sole argument:

    from standalorm import orm_init
    
    orm_init(__file__)
    
  5. Finally, import your models:

    # orm_init() must be imported AND called before this!
    
    from db import models  # Replace "db" with the name of your Django app if necessary
    
    # Do stuff with your models here
    

That's it.

This example doesn't demonstrate the full extent of standalorm's capabilities. You'll have to see the documentation for that.

Database Support

standalorm supports Oracle, PostgreSQL, and SQLite databases. A SQLite database connection comes configured for you, and standalorm will use it by default if you don't add a different one yourself. More on adding database connections can be found in the documentation.

Additional Notes

standalorm is intended for people who are already familiar with Django's ORM; as such, the basics of how to use the ORM are outside the scope of both this README and standalorm's documentation. If you're looking to familiarize yourself with Django's ORM, see Django's own documentation, particularly the sections on models and making queries.

Documentation

standalorm's full documentation can be found at https://standalorm.readthedocs.io.

Attributions

standalorm is based on Dan Caron's Django ORM Standalone Template.

"Django" is a registered trademark of the Django Software Foundation, which does not endorse this software.

License

standalorm is released under the MIT License.

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

standalorm-1.0.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

standalorm-1.0.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file standalorm-1.0.0.tar.gz.

File metadata

  • Download URL: standalorm-1.0.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.0 Windows/10

File hashes

Hashes for standalorm-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7f75165b6d103ba561024e48b7cbb5d1662e88b8cd293f87c4b9fdc9fb84a913
MD5 fb92013bef4a215d735305da90fd4f0a
BLAKE2b-256 bc479e0abcc0ed37c4d90f4b5e696866b330e90a1b61a13bd467b657fd9f0cc9

See more details on using hashes here.

File details

Details for the file standalorm-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: standalorm-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.0 Windows/10

File hashes

Hashes for standalorm-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f5bcea7ffb97c66d84723a6c177ced3e41b0d5f8fe9dd0252ec3c8bce673c74
MD5 7cb7e6df44585cf8721ad34e0e9c2f3d
BLAKE2b-256 7624d0e9036879eb3b259817e15b5bec11d8685f0e11e0d531db0a86cf661be5

See more details on using hashes here.

Supported by

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