Is it possible to use Django models module only in my project?
<p>I am developing a small independent python application which uses Celery. I have built this using django framework but my application is back end only. This means that the users do not need to visit my site and my application is built only for the purpose of receiving tasks queue from celery and performing operations on the database. In order to perform operations on the database, I need to use Django modules.</p>

<p>What I am trying to do is eliminate the rest of my django application and use ONLY celery and django models modules (including the dependencies required to run these).</p>

<p>In short, my simple celery application will be running receiving instructions from my redis broker and perform operations in database using django models.</p>

<p>Is is possible to do this? If so, how?</p>

<p>Here is my project structure:</p>

<pre><code>myproject/
--manage.py
--myproject/
----celery.py
----models.py
----settings.py
----tasks.py
----urls.py
----wsgi.py
</code></pre>

<p>Here is my settings.py:</p>

<p>In your project's settings.py, just add this at beginning.</p>

<pre><code>import django
import os

sys.path.insert(0, your_project_path) # Ensure python can find your project
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
django.setup()
</code></pre>

<p>Then you can use django orm, remember to delete the middleware you don't need in django settings.</p>

python django django-models celery