The less boilerplate the better.
To run the app in the recommended configuration, you will need the following installed:
- Docker and Docker Compose
- uv (for Python)
- node and npm (for JavaScript)
On Windows, you will also need to install make, which you can do by
following these instructions.
Run the following command to initialize your application:
make initThis will:
- Build and run your Postgres database
- Build and run your Redis database
- Run your database migrations
- Install front end dependencies
Then you can start the app:
make devThis will run your Django server and build and run your front end (JavaScript and CSS) pipeline.
Your app should now be running! You can open it at localhost:8000.
If you're just getting started, try these steps next.
You can run make to see other helper functions, and you can view the source
of the file in case you need to run any specific commands.
You can also install/run the app directly on your OS using the instructions below.
You can setup a virtual environment and install dependencies in a single command with:
uv syncThis will create your virtual environment in the .venv directory of your project root.
If you are using Docker you can skip these steps.
Create a database named python_tutorial.
createdb python_tutorial
Create database migrations:
uv run manage.py makemigrations
Create database tables:
uv run manage.py migrate
uv run manage.py runserverTo build JavaScript and CSS files, first install npm packages:
npm installThen build (and watch for changes locally):
npm run devCelery can be used to run background tasks.
Celery requires Redis as a message broker, so make sure it is installed and running.
You can run it using:
celery -A python_tutorial worker -l INFO --pool=soloOr with celery beat (for scheduled tasks):
celery -A python_tutorial worker -l INFO -B --pool=soloNote: Using the solo pool is recommended for development but not for production.
Using make:
make translationsNative:
uv run manage.py makemessages --all --ignore node_modules --ignore .venv
uv run manage.py makemessages -d djangojs --all --ignore node_modules --ignore .venv
uv run manage.py compilemessages --ignore .venvTo setup Google Authentication, follow the instructions here.
To setup Github Authentication, follow the instructions here.
To install the Git commit hooks run the following:
uv run pre-commit install --install-hooksOnce these are installed they will be run on every commit.
For more information see the docs.
To run tests:
Using make:
make testNative:
uv run manage.py testOr to test a specific app/module:
Using make:
make test ARGS='apps.web.tests.test_basic_views --keepdb'Native:
uv run manage.py test apps.web.tests.test_basic_views --keepdbOn Linux-based systems you can watch for changes using the following:
find . -name '*.py' | entr uv run manage.py test apps.web.tests.test_basic_views