Browse Source

Django users do not have to specify DJANGO_SETTINGS_MODULE

Ask Solem 11 years ago
parent
commit
29244168ae
3 changed files with 7 additions and 47 deletions
  1. 2 37
      docs/django/first-steps-with-django.rst
  2. 4 6
      docs/whatsnew-3.1.rst
  3. 1 4
      examples/django/README.rst

+ 2 - 37
docs/django/first-steps-with-django.rst

@@ -118,42 +118,6 @@ its own request information.  This is using the new ``bind=True`` task option
 introduced in Celery 3.1 to easily refer to the current task instance.
 
 
-The `celery` command
---------------------
-
-To use the :program:`celery` command with Django you need to
-set up the :envvar:`DJANGO_SETTINGS_MODULE` environment variable:
-
-.. code-block:: bash
-
-    $ DJANGO_SETTINGS_MODULE='proj.settings' celery -A proj worker -l info
-
-    $ DJANGO_SETTINGS_MODULE='proj.settings' celery -A proj status
-
-If you find this inconvienient you can create a small wrapper script
-alongside ``manage.py`` that automatically binds to your app, e.g. ``proj/celery.py``
-
-:file:`proj/celery.py`
-
-.. code-block:: python
-
-    #!/usr/bin/env python
-    import os
-
-    from proj.celery import celery
-
-
-    if __name__ == '__main__':
-        os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proj.celery')
-        celery.start()
-
-Then you can use this command directly:
-
-.. code-block:: bash
-
-    $ ./celery.py status
-
-
 Using the Django ORM/Cache as a result backend.
 -----------------------------------------------
 
@@ -210,7 +174,8 @@ development it is useful to be able to start a worker instance by using the
 
 .. code-block:: bash
 
-    $ DJANGO_SETTINGS_MODULE='proj.settings' celery -A proj worker -l info
+    $ celery -A proj worker -l info
+
 
 For a complete listing of the command-line options available,
 use the help command:

+ 4 - 6
docs/whatsnew-3.1.rst

@@ -323,16 +323,14 @@ but if you would like to experiment with it you should know that:
 
 - You no longer use ``manage.py``
 
-    Instead you use the :program:`celery` command directly, but for that to
-    work you need to specify the :envvar:`DJANGO_SETTINGS_MODULE` environment
-    variable:
+    Instead you use the :program:`celery` command directly:
 
     .. code-block:: bash
 
-        DJANGO_SETTINGS_MODULE='proj.settings' celery -A proj worker -l info
+        celery -A proj worker -l info
 
-    You can also set a default value in your app module so you
-    don't have to type it every time: just see the example in the :ref:`Django
+    For this to work your app module must store the  :envvar:`DJANGO_SETTINGS_MODULE`
+    environment variable, see the example in the :ref:`Django
     guide <django-first-steps>`.
 
 To get started with the new API you should first read the :ref:`first-steps`

+ 1 - 4
examples/django/README.rst

@@ -31,9 +31,6 @@ points to the currently active Celery instance.
 Starting the worker
 ===================
 
-The ``DJANGO_SETTINGS_MODULE`` environment must be set when starting the
-worker:
-
 .. code-block:: bash
 
-    $ DJANGO_SETTINGS_MODULE='proj.settings' celery -A proj worker -l info
+    $ celery -A proj worker -l info