Installation
Using the DjangoKit CLI to generate a project, as documented in the Get Started doc, is generally recommended, but you can install DjangoKit manually if you need to or if you want to try it out in an existing project.
Steps
- Install Python >= 3.10
- Create a project directory with the necessary files
- Add the required settings
- Create a virtualenv for the project
- Install DjangoKit packages into the virtualenv
- Install your project into the virtualenv
Project Directory
Create a directory for your project. Within this directory, create some directories and files:
- A
srcsubdirectory. - A
src/<package>for the package containing your code. - A
src/<package>/modelssubdirectory for your Django models. - A
src/<package>/routessubdirectory for your DjangoKit routes. pyproject.tomlto specify your Python project details and dependencies. If you use uv, you can create this withuv init. You can also use any other dependency manager.settings.public.tomlandsettings.development.tomlfor your project configuration.
As an example, let's assume you're creating a blog. Your project directory should end up looking like this:
blog/
src/
blog/
__init__.py
models/
__init__.py ← export all model classes from here
post.py ← Post model
routes/
_slug/
page.html ← blog post
_init__.py
app.html
layout.html
page.html ← blog post listing
pyproject.toml
settings.development.toml
settings.public.toml
NOTE:
manage.py,settings.py, andurls.pyaren't needed in a typical DjangoKit project.
Settings
Add the following settings to settings.public.toml, replacing <package> with the name of your package (e.g., blog from the example above):
[djangokit]
package = "<package>"
Add the following settings to settings.development.toml:
[django]
DEBUG = true
SECRET_KEY = "Generate a random key for use in development ONLY"
Python Dependencies
For each of these, run uv add <name> (or the equivalent for whichever dependency manager you're using).
- Django
- org-djangokit-core
- org-djangokit-cli