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.
-
Create a Django app in your project's root directory:
$ standalorm startapp -
Create your models in
app-directory/models.py:from django.db import models # For demonstration purposes only. class ExampleModel(models.Model): exampleField = models.Field()
-
Make and apply your migrations:
$ standalorm makemigrations$ standalorm migrate -
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__)
-
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.
Metadata
Release files for standalorm 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 | |
|---|---|---|---|
| standalorm-1.0.0.tar.gz | 12.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| standalorm-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.4 kB
Release files / standalorm-1.0.0.tar.gz
| Download URL | standalorm-1.0.0.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f75165b6d103ba561024e48b7cbb5d1662e88b8cd293f87c4b9fdc9fb84a913
|
|
BLAKE2b-256 checksum How to use checksums |
bc479e0abcc0ed37c4d90f4b5e696866b330e90a1b61a13bd467b657fd9f0cc9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.9.0 Windows/10
|
Release files / standalorm-1.0.0-py3-none-any.whl
| Download URL | standalorm-1.0.0-py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5f5bcea7ffb97c66d84723a6c177ced3e41b0d5f8fe9dd0252ec3c8bce673c74
|
|
BLAKE2b-256 checksum How to use checksums |
7624d0e9036879eb3b259817e15b5bec11d8685f0e11e0d531db0a86cf661be5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.9.0 Windows/10
|