mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-02-20 13:30:58 +03:00
Update local development docs
This commit is contained in:
parent
62acc97b59
commit
007de47f59
|
@ -14,16 +14,6 @@ Make sure to have the following on your host:
|
|||
* Redis_, if using Celery
|
||||
* Cookiecutter_
|
||||
|
||||
First things first.
|
||||
|
||||
#. Create a virtualenv: ::
|
||||
|
||||
$ python3.12 -m venv <virtual env path>
|
||||
|
||||
#. Activate the virtualenv you have just created: ::
|
||||
|
||||
$ source <virtual env path>/bin/activate
|
||||
|
||||
#. .. include:: generate-project-block.rst
|
||||
|
||||
#. Install development requirements: ::
|
||||
|
@ -31,7 +21,7 @@ First things first.
|
|||
$ cd <what you have entered as the project_slug at setup stage>
|
||||
$ uv sync
|
||||
$ git init # A git repo is required for pre-commit to install
|
||||
$ pre-commit install
|
||||
$ uv run pre-commit install
|
||||
|
||||
.. note::
|
||||
|
||||
|
@ -71,15 +61,15 @@ First things first.
|
|||
|
||||
#. Apply migrations: ::
|
||||
|
||||
$ python manage.py migrate
|
||||
$ uv run python manage.py migrate
|
||||
|
||||
#. If you're running synchronously, see the application being served through Django development server: ::
|
||||
|
||||
$ python manage.py runserver 0.0.0.0:8000
|
||||
$ uv run python manage.py runserver 0.0.0.0:8000
|
||||
|
||||
or if you're running asynchronously: ::
|
||||
|
||||
$ uvicorn config.asgi:application --host 0.0.0.0 --reload --reload-include '*.html'
|
||||
$ uv run uvicorn config.asgi:application --host 0.0.0.0 --reload --reload-include '*.html'
|
||||
|
||||
If you've opted for Webpack or Gulp as frontend pipeline, please see the :ref:`dedicated section <bare-metal-webpack-gulp>` below.
|
||||
|
||||
|
@ -136,7 +126,7 @@ Following this structured approach, here's how to add a new app:
|
|||
|
||||
#. **Create the app** using Django's ``startapp`` command, replacing ``<name-of-the-app>`` with your desired app name: ::
|
||||
|
||||
$ python manage.py startapp <name-of-the-app>
|
||||
$ uv run python manage.py startapp <name-of-the-app>
|
||||
|
||||
#. **Move the app** to the Django Project Root, maintaining the project's two-tier structure: ::
|
||||
|
||||
|
@ -203,14 +193,14 @@ Next, make sure `redis-server` is installed (per the `Getting started with Redis
|
|||
|
||||
Start the Celery worker by running the following command in another terminal::
|
||||
|
||||
$ celery -A config.celery_app worker --loglevel=info
|
||||
$ uv run celery -A config.celery_app worker --loglevel=info
|
||||
|
||||
That Celery worker should be running whenever your app is running, typically as a background process,
|
||||
so that it can pick up any tasks that get queued. Learn more from the `Celery Workers Guide`_.
|
||||
|
||||
The project comes with a simple task for manual testing purposes, inside `<project_slug>/users/tasks.py`. To queue that task locally, start the Django shell, import the task, and call `delay()` on it::
|
||||
|
||||
$ python manage.py shell
|
||||
$ uv run python manage.py shell
|
||||
>> from <project_slug>.users.tasks import get_users_count
|
||||
>> get_users_count.delay()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user