RE: How do I create a standalone python application that uses the django environment (e.g. the ORM etc...)?

2013-09-23 Thread Sells, Fred
Creating django management commands is easy and then all works nicely. Assuming you're at 1.5, not sure about older ones. Just google it. From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of DJ-Tom Sent: Monday, September 16, 2013 10:26 AM To:

Re: How do I create a standalone python application that uses the django environment (e.g. the ORM etc...)?

2013-09-18 Thread DJ-Tom
Hi Brad, that fixed it - plus I now have a better understanding of how python works. I'm beginning to understand what Jeff Knupp writes here: http://www.jeffknupp.com/blog/2012/12/11/learning-python-via-django-considered-harmful/ :-) Am Dienstag, 17. September 2013 17:58:42 UTC+2 schrieb Brad

Re: How do I create a standalone python application that uses the django environment (e.g. the ORM etc...)?

2013-09-17 Thread Russell Keith-Magee
Hi, Django's own documentation contains a description of how to do this: https://docs.djangoproject.com/en/1.5/topics/settings/#using-settings-without-setting-django-settings-module James Bennett has also written a blog post that gives a good rundown on approaches you can take:

Re: How do I create a standalone python application that uses the django environment (e.g. the ORM etc...)?

2013-09-17 Thread Brad Pitcher
To make my code work, you could set DJANGO_SETTINGS_MODULE to 'my_project.settings', and just put formdesigner.py directly under my_project. If you wanted to keep formdesigner.py where it is, you would want to change the sys.path.append line to this:

Re: How do I create a standalone python application that uses the django environment (e.g. the ORM etc...)?

2013-09-17 Thread DJ-Tom
I need to use the ORM and more specifcally I want to use the models I defined inside my Django application. I want to avoid using a different ORM like Alchemy because then I would have to duplicate the work I already put into my Django models - i hate duplicating work... Apart from that, I

Re: How do I create a standalone python application that uses the django environment (e.g. the ORM etc...)?

2013-09-17 Thread DJ-Tom
Hi, I'm also not sure if the python file is at the correct location. This is how the directory structure looks: my_project \my_project\ settings.py \my_app\ # this is where my models are defined models.py formdesigner.py Where should my formdesigner.py be

Re: How do I create a standalone python application that uses the django environment (e.g. the ORM etc...)?

2013-09-16 Thread Avraham Serour
the question is what for? other than the ORM what else is useful for a desktop app? if it is only the ORM you want take a look at http://www.sqlalchemy.org/ On Mon, Sep 16, 2013 at 7:17 PM, Brad Pitcher wrote: > You need to do something like this before import django

Re: How do I create a standalone python application that uses the django environment (e.g. the ORM etc...)?

2013-09-16 Thread Brad Pitcher
You need to do something like this before import django stuff: import os import sys sys.path.append(os.path.abspath(os.path.dirname(__file__))) os.environ['DJANGO_SETTINGS_MODULE'] = 'web.settings' - Brad Pitcher On Mon, Sep 16, 2013 at 8:19 AM, Nigel Legg

Re: How do I create a standalone python application that uses the django environment (e.g. the ORM etc...)?

2013-09-16 Thread Nigel Legg
Shouldn't it be from django.db import models ?? Cheers, Nigel 07914 740972 On 16 September 2013 15:25, DJ-Tom wrote: > For reporting purposes I want to use List & Label from Combit. The > web/online part is no big deal since the reporting module can be run >

How do I create a standalone python application that uses the django environment (e.g. the ORM etc...)?

2013-09-16 Thread DJ-Tom
For reporting purposes I want to use List & Label from Combit. The web/online part is no big deal since the reporting module can be run without user interface (creating Excel or PDF files) But the actual form designer part that is used to define the report layout is a windows GUI application,