Re: use Django's database layer for a regular python program?

2007-06-29 Thread ahlongxp

I found python shelve module quite suitable for my need.
Thanks anyway.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: use Django's database layer for a regular python program?

2007-06-27 Thread Forest Bond
On Wed, Jun 27, 2007 at 04:53:12PM +0200, Roodie wrote:
> 
> I worked on a console application which uses django to do some  
> database related tasks.
> I started my code with these lines:
> 
> ---
> 
> #!/usr/bin/env python
> import sys
> sys.path.append('/Library/Frameworks/Python.framework/Versions/2.4/ 
> lib/python2.4/site-packages/django')
> sys.path.append('/path/to/the/application/directory/')
> 
> import os
> os.environ['DJANGO_SETTINGS_MODULE'] = 'applicationname.settings'
> 
> ---
> 
>  From this point you can continue by importing the neccessary  
> libraries and writing your code.
> 
> Maybe there is a better way of doing it but works perfeclty.

Have a look at django.conf.settings.configure:


from django.conf import settings
settings.configure(
  INSTALLED_APPS = ( 'myappcontainingmodels', ),
  DEBUG = False
)


See:

http://www.djangoproject.com/documentation/settings/#using-settings-without-setting-django-settings-module

-Forest


signature.asc
Description: Digital signature


Re: use Django's database layer for a regular python program?

2007-06-27 Thread Roodie

I worked on a console application which uses django to do some  
database related tasks.
I started my code with these lines:

---

#!/usr/bin/env python
import sys
sys.path.append('/Library/Frameworks/Python.framework/Versions/2.4/ 
lib/python2.4/site-packages/django')
sys.path.append('/path/to/the/application/directory/')

import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'applicationname.settings'

---

 From this point you can continue by importing the neccessary  
libraries and writing your code.

Maybe there is a better way of doing it but works perfeclty.

---
Roodie




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: use Django's database layer for a regular python program?

2007-06-27 Thread Michael K

It's currently being done for a server application, I don't see why it
couldn't be used for a desktop application as well?

Check out http://www.silverstripesoftware.com/blog/archives/51 and
http://code.google.com/p/evennia/

The first is a desktop application that uses Django, I'm just not sure
if it's using the database backend or not.   The second is a MUD
server that uses Django for data storage as well as the web services
for MUD management.

It should be as simple as creating a new project and ignoring the urls/
views part of the code, and just importing the models as normal.

HTH,

Michael

On Jun 27, 7:09 am, ahlongxp <[EMAIL PROTECTED]> wrote:
> I'm currently developing a desktop application, not a web application.
> But I want to use django's models to store and retrieve data in
> Database. Is it possible? How should I do it?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



use Django's database layer for a regular python program?

2007-06-27 Thread ahlongxp

I'm currently developing a desktop application, not a web application.
But I want to use django's models to store and retrieve data in
Database. Is it possible? How should I do it?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---