django-singlefile
This is a small library that makes it easier to write single-file Django applications in a similar way to how you'd write Flask applications.
It's still alpha, but hey, it works for small projects.
Example App
from django.http import HttpResponse
from django.singlefile import SingleFileApp
app = SingleFileApp()
@app.path("")
def index(request):
name = request.GET.get("name", "World")
return HttpResponse(f"Hello, {name}!")
if __name__ == "__main__":
app.main()
To run the app, you can just call it from the command line::
python app.py runserver
Or you can pass the app object inside it to a WSGI server as normal!
If you'd like to see a more in-depth example app, take a look at the project I initially wrote this for: andrewgodwin/emf-equipment.
Supported Features
- Templates: Put them in a
templates/directory. - Static Files: Put them in a
static/directory. - Class-Based Views: Work fine; use
@app.path()on the class itself. - Forms: Use them as normal.
Unsupported Features
If you want to use these, just go make a normal Django project; trying to fit them into a single file is a bad idea due to their innate complexity.
- Models/Migrations (maybe in future, if I can figure out how nicely)
- Admin
- Authentication
Desired Features
- Project Conversion: An easy way to take a single-file app like this and
expand it into a "full" Django project, like
startprojectwould make.
Metadata
Release files for django-singlefile 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django-singlefile-0.2.2.tar.gz | 4.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_singlefile-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.9 kB
Release files / django-singlefile-0.2.2.tar.gz
| Download URL | django-singlefile-0.2.2.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc8a1e7e5ff025c5fd0b891a6f4f92818ca815bf5aab6797c9d541d16d7f9e53
|
|
BLAKE2b-256 checksum How to use checksums |
4fa829c8292829939e74aa9683ccd217b221cc7bb224eda940c98907bbf2a971
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.6
|
Release files / django_singlefile-0.2.2-py3-none-any.whl
| Download URL | django_singlefile-0.2.2-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc060620ca5352b23ab4eb3a001abf6e59d4253908651553c4bd1159100c9f8f
|
|
BLAKE2b-256 checksum How to use checksums |
5bc8f4aed310fa69b57c9a97c36c3cd9288066a32863004360d7bd475ea0c9c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.6
|
Security for django-singlefile 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.