issue with filter database on a standalone script

2021-06-18 Thread Zolo Kiala
Dear Django developers, I would like to connect my dash plotly dashboard to a django model filtered to a specific user. I was able to import the model into a standalone script. The problem is that I can only connect the dashboard to the values related to all the users in the database. But I want

Re: standalone script to call a view

2013-06-28 Thread Larry Martell
On Fri, Jun 28, 2013 at 7:47 AM, Javier Guerra Giraldez wrote: > On Fri, Jun 28, 2013 at 8:21 AM, Larry Martell > wrote: >> I don't really understand what you mean by "create a function which is >> be called by view and your script." > > > AFAICT, your situation looks like this: > > you have thi

Re: standalone script to call a view

2013-06-28 Thread Sergiy Khohlov
for this case you can use django shell Many thanks, Serge +380 636150445 skype: skhohlov On Fri, Jun 28, 2013 at 4:47 PM, Javier Guerra Giraldez wrote: > On Fri, Jun 28, 2013 at 8:21 AM, Larry Martell > wrote: > > I don't really understand what you mean by "create a function which is

Re: standalone script to call a view

2013-06-28 Thread Javier Guerra Giraldez
On Fri, Jun 28, 2013 at 8:21 AM, Larry Martell wrote: > I don't really understand what you mean by "create a function which is > be called by view and your script." AFAICT, your situation looks like this: you have this: def myview(request, maybesomeparams...): does lots of things

Re: standalone script to call a view

2013-06-28 Thread Larry Martell
nd if I go any further down I'll have to duplicate some existing code, which I'd rather not have to do. > On Fri, Jun 28, 2013 at 3:41 PM, Larry Martell > wrote: >> >> I am trying to write a standalone script that calls one of my views. I >> can call the view, bu

Re: standalone script to call a view

2013-06-28 Thread Sergiy Khohlov
, Jun 28, 2013 at 3:41 PM, Larry Martell wrote: > I am trying to write a standalone script that calls one of my views. I > can call the view, but I'm having a problem with proving what it > wants. One of the things the view needs is request.user, and that > looks like thi

standalone script to call a view

2013-06-28 Thread Larry Martell
I am trying to write a standalone script that calls one of my views. I can call the view, but I'm having a problem with proving what it wants. One of the things the view needs is request.user, and that looks like this: (Pdb) type(request.user) (Pdb) type(request) I'm trying to

Re: How to syncdb programatically (django standalone script) ?

2012-11-20 Thread Samar Agrawal
Wow this is the coolest thing...thnx On Tuesday, 16 September 2008 07:20:24 UTC+5:30, Steve Holden wrote: > > Mathieu Leplatre wrote: > > Hi all, > > > > I found many post about specific errors regarding django as a > > standalone tool. > > > > With a little bit of researching, I ended up with thi

Re: How to syncdb programatically (django standalone script) ?

2012-04-23 Thread Fábio Santos
There's a problem in your INSTALLED_APPS setting. You have to use: ('polls',) Notice the trailing comma. When writing tuples with one item, you must have a traling comma. It indicates that you are writing a tuple, and not simply an expression enclosed in parenthesis. A workaround is to use a li

Re: how to use Django ORM in standalone script

2012-03-13 Thread H.T. Wei
ps, and it will typically be easier to > pull the whole thing than to tease out just enough. If your project > is in a suitable VCS, that is a good way to make the copy. > > Bill > > On 3/12/12, H.T. Wei wrote: > > Hi, > > > > If anyone can suggest what is the

Re: how to use Django ORM in standalone script

2012-03-12 Thread Bill Freeman
elevant apps, and it will typically be easier to pull the whole thing than to tease out just enough. If your project is in a suitable VCS, that is a good way to make the copy. Bill On 3/12/12, H.T. Wei wrote: > Hi, > > If anyone can suggest what is the best way to use Django ORM in standalo

how to use Django ORM in standalone script

2012-03-12 Thread H.T. Wei
Hi, If anyone can suggest what is the best way to use Django ORM in standalone script for accessing database? The "standalone script" is located on the server different from Django server but access the same database server. Thanks in advance! Steve -- " stay hungry, stay fo

Django standalone script with Multiple databases and routers

2010-07-22 Thread 水鏡
Dears, I am using Django 1.2.1 now. When I use Multiple databases and routers, It's working correctly in my web views. But when I try to use it in standalone script, like this ### os.sys.path.append(DJANGO_PROJECT_PATH) from django.core.management import setup_environ from test import set

Re: django ORM memory leaks in standalone script

2010-06-05 Thread yakovenko
hello kanniga, I use correct user and password. I can get data from database. I read about it in an one post that described what may be due not correct settings of connect to database, but there were no details. On Jun 5, 2:54 pm, kanniga sivasubramanian wrote: > hello yakovenko sir, >         I

Re: django ORM memory leaks in standalone script

2010-06-05 Thread kanniga sivasubramanian
hello yakovenko sir, I think your databse_user and database_password are incorrect. I had affected by this problem. You will give correct username and password of mysql. On Sat, Jun 5, 2010 at 1:02 AM, tmitchell wrote: > Holy reading comprehension, Batman.  Just saw you have DEBUG off, >

Re: django ORM memory leaks in standalone script

2010-06-04 Thread tmitchell
Holy reading comprehension, Batman. Just saw you have DEBUG off, ignore previous comment. On Jun 4, 10:34 am, Кирилл Яковенко wrote: > I have tried this method, but it didn't give any results. > I suspect that this is due to incorrect settings of the database or connect > to it. > > 2010/6/4 Dj

Re: django ORM memory leaks in standalone script

2010-06-04 Thread tmitchell
Are you running with DEBUG on? I've noticed the same memory growth in standalone scripts when in DEBUG mode. It may be related to this: http://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-context-processors-debug On Jun 4, 10:34 am, Кирилл Яковенко wrote: > I have tried this met

Re: django ORM memory leaks in standalone script

2010-06-04 Thread Кирилл Яковенко
I have tried this method, but it didn't give any results. I suspect that this is due to incorrect settings of the database or connect to it. 2010/6/4 Dj Gilcrease > On Fri, Jun 4, 2010 at 6:44 AM, yakovenko wrote: > > import os > > import sys > > os.environ['DJANGO_SETTINGS_MODULE'] = 'md.setti

Re: django ORM memory leaks in standalone script

2010-06-04 Thread Dj Gilcrease
On Fri, Jun 4, 2010 at 6:44 AM, yakovenko wrote: > import os > import sys > os.environ['DJANGO_SETTINGS_MODULE'] = 'md.settings' > sys.path.append('/md/lib') > from django.db import close_connection, reset_queries > from md.mddata.models import Info > def test(): >  for i in Info.objects.all(): >

django ORM memory leaks in standalone script

2010-06-04 Thread yakovenko
Hello guys, I use django ORM in standalone daemon. And It sucks more and more memory. I have created small script for testing: --- import os import sys os.environ['DJANGO_SETTINGS_MODULE'] = 'md.settings' sys.path.append('/md/lib') from django.db

Re: ORM Cache in a standalone script

2009-10-08 Thread Alexis MINEAUD
t;> Ok, my bad, the sequence works well, i just confused the field name... >> But the problem is still there if the update is done by another actor than >> Django itself. >> >> My standalone script is daemon which poll my DB with a XX.objects.all(). >> If i upda

Re: ORM Cache in a standalone script

2009-10-08 Thread Karen Tracey
On Thu, Oct 8, 2009 at 5:07 AM, Alexis MINEAUD wrote: > Ok, my bad, the sequence works well, i just confused the field name... > But the problem is still there if the update is done by another actor than > Django itself. > > My standalone script is daemon which poll my DB with a

Re: ORM Cache in a standalone script

2009-10-08 Thread Alexis MINEAUD
Ok, my bad, the sequence works well, i just confused the field name... But the problem is still there if the update is done by another actor than Django itself. My standalone script is daemon which poll my DB with a XX.objects.all(). If i updated myself a row from XX, the daemon doesn't se

Re: ORM Cache in a standalone script

2009-10-07 Thread Karen Tracey
] >>> Tag.objects.create(name='tag1') >>> Tag.objects.all() [] >>> tag = Tag.objects.get() >>> tag >>> tag.name = 'tag11' >>> tag.save() >>> Tag.objects.all() [] Is there something you've left out of your account

ORM Cache in a standalone script

2009-10-07 Thread laligatz
Hi everybody. I'm stuck on a problem with the Django ORM. After a basic query like select * from table where id = 1, the result is still the same although i've update the row in the DB. Example: >>> Tag.objects.all() [] >>> tag = Tag.objects.all().get() >>> tag >>> tag.name = 'tag11' >>> t

Re: Standalone script with django's ORM and multiprocessing

2009-08-11 Thread Spajderix
prabhu S pisze: > Solution appears like a hack to me. Why do you close the connection in > every process? Can you not just close once in parent? Execute commits > alone in each process. > I've checked that. Unfortunately, in my case, it won't work. I have a loop looking like this: for job in

Re: Standalone script with django's ORM and multiprocessing

2009-08-11 Thread Malcolm Tredinnick
On Tue, 2009-08-11 at 03:12 -0700, prabhu S wrote: [...] > Why do you close the connection in > every process? Can you not just close once in parent? That would also work. Regards, Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscrib

Re: Standalone script with django's ORM and multiprocessing

2009-08-11 Thread prabhu S
0, Spajderix wrote: > > >> Hi! > > >> I've written a standalone script, which looks throught a table in db for > >> tasks to perform. It then starts subprocesses for each task it founds > >> using multiprocessing.Process class from python. Everything

Re: Standalone script with django's ORM and multiprocessing

2009-08-11 Thread Spajderix
Malcolm Tredinnick pisze: > On Tue, 2009-08-11 at 11:06 +0200, Spajderix wrote: > >> Hi! >> >> I've written a standalone script, which looks throught a table in db for >> tasks to perform. It then starts subprocesses for each task it founds >> using

Re: Standalone script with django's ORM and multiprocessing

2009-08-11 Thread Malcolm Tredinnick
On Tue, 2009-08-11 at 11:06 +0200, Spajderix wrote: > Hi! > > I've written a standalone script, which looks throught a table in db for > tasks to perform. It then starts subprocesses for each task it founds > using multiprocessing.Process class from python. Everything

Standalone script with django's ORM and multiprocessing

2009-08-11 Thread Spajderix
Hi! I've written a standalone script, which looks throught a table in db for tasks to perform. It then starts subprocesses for each task it founds using multiprocessing.Process class from python. Everything's fine when there is one task, but when i try to start more subprocesses at

Re: standalone script

2009-08-04 Thread Vitaly
I have found where our mistake was, it was inside __init__.py of our application. Thanks anyway On 4 Сер, 18:45, Michael wrote: > > On Tue, Aug 4, 2009 at 11:29 AM, Vitaly wrote: > > I did cut of our settings > > > Here it ishttp://dpaste.com/75091/ > > > Using your method I got no error but a

Re: standalone script

2009-08-04 Thread Vitaly
It should be, but not :) The matter is that I changed some code from django.conf import settings from fg import settings as app_settings settings.configure(app_settings, **{'DATABASE_NAME': ':memory:', 'DATABASE_ENGINE': 'sqlite3',

Re: standalone script

2009-08-04 Thread Michael
> > On Tue, Aug 4, 2009 at 11:29 AM, Vitaly wrote: > I did cut of our settings > > Here it is http://dpaste.com/75091/ > > Using your method I got no error but app_settings and INSTALLED_APPS > were cleaned up and contains nothing. Strange. > > Thanks > Vitaly > Why not just: from django.conf

Re: standalone script

2009-08-04 Thread Vitaly
I did cut of our settings Here it is http://dpaste.com/75091/ Using your method I got no error but app_settings and INSTALLED_APPS were cleaned up and contains nothing. Strange. Thanks Vitaly On 4 Сер, 18:11, Michael wrote: > On Tue, Aug 4, 2009 at 11:05 AM, Vitaly wrote: > > > Oh, yeah, the

Re: standalone script

2009-08-04 Thread Michael
On Tue, Aug 4, 2009 at 11:05 AM, Vitaly wrote: > > Oh, yeah, there was only place, but when I removed this code nothing > changed. > > I do not know about this import > > from django.utils.translation import ugettext_lazy as _ > This (and anything from utils ideally) shouldn't need settings top b

Re: standalone script

2009-08-04 Thread Vitaly
For running our test script we are using standalone script. > > > Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) > > [GCC 4.3.3] on linux2 > > Type "help", "copyright", "credits" or "license" for more information. > >

Re: standalone script

2009-08-04 Thread Michael
On Tue, Aug 4, 2009 at 10:46 AM, Vitaly wrote: > > Hey there > > For running our test script we are using standalone script. > > Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) > [GCC 4.3.3] on linux2 > Type "help", "copyright", "credi

Re: standalone script

2009-08-04 Thread krylatij
or there is another way. create custom command for manage.py (http://docs.djangoproject.com/en/dev/howto/custom-management-commands/ #howto-custom-management-commands) it's pretty simple. then write bash script like this: #!/bin/bash export PYTHONPATH=/path/to/django cd /path/to/project python man

Re: standalone script

2009-08-04 Thread Vitaly
PYTHONPATH is ok, and application is working, but see that I am running tests, and it raises exception when tries to configure custom settings. On 4 Сер, 17:52, krylatij wrote: > I guess you are using SSH? > > so before running your script run: > export PYTHONPATH=/path/to/django > > hope this h

Re: standalone script

2009-08-04 Thread krylatij
I guess you are using SSH? so before running your script run: export PYTHONPATH=/path/to/django hope this helps --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

standalone script

2009-08-04 Thread Vitaly
Hey there For running our test script we are using standalone script. Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from django.conf im

Re: how to use django ORM in standalone script ?

2009-02-23 Thread Malcolm Tredinnick
On Mon, 2009-02-23 at 14:35 +, David Reynolds wrote: > 2009/2/23 Konstantin S : > > > > Hello! > > > > I need to postprocess some data in my models and the most natural way > > of doing this would be to run periodically standalone script. But on > > the

Re: how to use django ORM in standalone script ?

2009-02-23 Thread David Reynolds
2009/2/23 Konstantin S : > > Hello! > > I need to postprocess some data in my models and the most natural way > of doing this would be to run periodically standalone script. But on > the other hand I want to use framework ORM just because it would much > more handy than r

Re: how to use django ORM in standalone script ?

2009-02-23 Thread Alex Gaynor
On Mon, Feb 23, 2009 at 8:04 AM, Konstantin S wrote: > > Hello! > > I need to postprocess some data in my models and the most natural way > of doing this would be to run periodically standalone script. But on > the other hand I want to use framework ORM just because it would

how to use django ORM in standalone script ?

2009-02-23 Thread Konstantin S
Hello! I need to postprocess some data in my models and the most natural way of doing this would be to run periodically standalone script. But on the other hand I want to use framework ORM just because it would much more handy than raw sql. What should I import to plug in django in standalone

Re: "setup_environ" can't help to run a standalone script

2009-02-15 Thread Orcun Avsar
hi and thanks for advice. however it doesn't seems like the problem because i did set all my python paths correctly and called setup_environ. it was like. this was the top of script before i solved the problem >>DIR=os.path.abspath(__file__) >>sys.path.append(imp.find_module("django")[1]) >>sys.

Re: "setup_environ" can't help to run a standalone script

2009-02-15 Thread pkenjora
Hi, You need to define the settings file on top of the python path and the path to your settings file. Start with the xample in the post below... http://blog.awarelabs.com/?p=15 Once you get it to work, back out some of the paths until you find the minimum you need. You will need to type

Re: "setup_environ" can't help to run a standalone script

2009-02-15 Thread Orcun Avsar
i added from django.db.models.loading import get_apps get_apps() before calling models and it solved the problem --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send emai

Re: "setup_environ" can't help to run a standalone script

2009-01-31 Thread 文武
I approve it You should just check your project's settings.py can be import 2009/1/31 Orcun Avsar > > > On 31 Ocak, 03:09, Malcolm Tredinnick > wrote: > > > I suspect you just haven't set > > up your Python path correctly (which is the cause of about 98% of all > > import-related problems on th

Re: "setup_environ" can't help to run a standalone script

2009-01-31 Thread Orcun Avsar
On 31 Ocak, 03:09, Malcolm Tredinnick wrote: > I suspect you just haven't set > up your Python path correctly (which is the cause of about 98% of all > import-related problems on this list). > > Regards, > Malcolm i checked my python path and added two path. 1)DIR=os.path.abspath(__file__)

Re: "setup_environ" can't help to run a standalone script

2009-01-30 Thread Malcolm Tredinnick
On Fri, 2009-01-30 at 04:58 -0800, Orcun Avsar wrote: > im trying to run a seperate script that is on my project directory. > setup_environ seems called correctly but progmram cant import models > properly That likely has nothing at all to do with setup_environ() -- which is only used to set up t

"setup_environ" can't help to run a standalone script

2009-01-30 Thread Orcun Avsar
im trying to run a seperate script that is on my project directory. setup_environ seems called correctly but progmram cant import models properly code: from django.core.management import setup_environ import settings setup_environ(settings) from indir.program.models import Program, Hit output:

Re: Error: No module named X (django standalone script)

2008-09-18 Thread Mathieu Leplatre
On Sep 17, 10:41 pm, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: > On Sep 17, 2008, at 11:45 PM, Mathieu Leplatre wrote: > > > > > > > Hi all, > > > I am starting a new thread, the first one became off-topic (http:// > > groups.google.com/group/django-users/browse_thread/thread/ > > 34b501d2d1f8849

Re: Error: No module named X (django standalone script)

2008-09-17 Thread Eric Abrahamsen
On Sep 17, 2008, at 11:45 PM, Mathieu Leplatre wrote: > > Hi all, > > I am starting a new thread, the first one became off-topic (http:// > groups.google.com/group/django-users/browse_thread/thread/ > 34b501d2d1f88496/f8a5d5ef5aeab62a) > > I want to do a simple external script that just relies o

Error: No module named X (django standalone script)

2008-09-17 Thread Mathieu Leplatre
Hi all, I am starting a new thread, the first one became off-topic (http:// groups.google.com/group/django-users/browse_thread/thread/ 34b501d2d1f88496/f8a5d5ef5aeab62a) I want to do a simple external script that just relies on django's ORM. So I did a single file testdjango.py : -- import

Re: How to syncdb programatically (django standalone script) ?

2008-09-17 Thread Mathieu Leplatre
Ronaldo, from what I read about signals, I don't think they would help me writing a standalone script... On Sep 17, 8:15 am, "Ronaldo Zacarias Afonso" <[EMAIL PROTECTED]> wrote: > Hi, I think you can use "Django signal feature". Threre is > documentation a

Re: How to syncdb programatically (django standalone script) ?

2008-09-17 Thread Ronaldo Zacarias Afonso
gt; Error: No module named p >> (for polls) >> >> If I put my script in a module or remove Meta : >> File "[...]/django/db/models/base.py", line 51, in __new__ >> kwargs = {"app_label": model_module.__name__.split('.')[-2]} >> Inde

Re: How to syncdb programatically (django standalone script) ?

2008-09-16 Thread Mathieu Leplatre
Error: No module named p > (for polls) > > If I put my script in a module or remove Meta : > File "[...]/django/db/models/base.py", line 51, in __new__ >     kwargs = {"app_label": model_module.__name__.split('.')[-2]} > IndexError: list index out of

Re: How to syncdb programatically (django standalone script) ?

2008-09-16 Thread Mathieu Leplatre
": model_module.__name__.split('.')[-2]} IndexError: list index out of range I wanted a simple standalone script with basic database store / retrieve of objects. Is it utopian ? Thanks again On Sep 16, 1:31 am, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Mon, Sep 15

Re: How to syncdb programatically (django standalone script) ?

2008-09-15 Thread James Bennett
On Mon, Sep 15, 2008 at 8:50 PM, Steve Holden <[EMAIL PROTECTED]> wrote: > This is k=nd of a wild-assed guess. Please tell me if it works. > > from django.core.management import call_command > call_command('syncdb') That is the way to do it; the whole manage.py/django-admin.py system was refactor

Re: How to syncdb programatically (django standalone script) ?

2008-09-15 Thread Steve Holden
Mathieu Leplatre wrote: > Hi all, > > I found many post about specific errors regarding django as a > standalone tool. > > With a little bit of researching, I ended up with this script below. > Unfortunately, it fails on database initialization. > > ... > ... > File "/home/mathieu/Code/uhm/svn/uh

How to syncdb programatically (django standalone script) ?

2008-09-15 Thread Mathieu Leplatre
Hi all, I found many post about specific errors regarding django as a standalone tool. With a little bit of researching, I ended up with this script below. Unfortunately, it fails on database initialization. ... ... File "/home/mathieu/Code/uhm/svn/uhm/django/db/backends/sqlite3/ base.py", lin

Re: Standalone script + get_absolute_url with urlresolvers

2008-07-14 Thread Rajesh Dhawan
> > Is it syntactically correct to have a views.py which is empty but > exists? I'm not really sure of the process Django will use to validate > the view. Django will look for all view functions that your project's various urls point to. So those functions need to exist. From that point of view,

Re: Standalone script + get_absolute_url with urlresolvers

2008-07-14 Thread MikeHowarth
h is empty but > exists? I'm not really sure of the process Django will use to validate > the view. > > I've also pasted the stack trace to Dpaste:http://dpaste.com/64942/ > > On Jul 14, 8:35 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > > > Hi Mike, >

Re: Standalone script + get_absolute_url with urlresolvers

2008-07-14 Thread MikeHowarth
t really sure of the process Django will use to validate the view. I've also pasted the stack trace to Dpaste: http://dpaste.com/64942/ On Jul 14, 8:35 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > Hi Mike, > > > > > > > I'm running a standalone script

Re: Standalone script + get_absolute_url with urlresolvers

2008-07-14 Thread Rajesh Dhawan
Hi Mike, > > I'm running a standalone script outside of the web server to do some > maintainence tasks. > > In particular I need to return the absolute url from one of my models, > however when I call the get_absolute_url() method, I'm getting a > ViewDoesNotExist

Standalone script + get_absolute_url with urlresolvers

2008-07-14 Thread MikeHowarth
I was wondering whether anyone can help me with a problem I'm having. I'm running a standalone script outside of the web server to do some maintainence tasks. In particular I need to return the absolute url from one of my models, however when I call the get_absolute_url() method, I&#

Re: Using django test suite with standalone script

2008-05-03 Thread Russell Keith-Magee
On Thu, May 1, 2008 at 9:02 PM, dcoy <[EMAIL PROTECTED]> wrote: > > What I want to do is to use the django test suite, or more > specifically the test environment it can set up (with the test-db with > pre-populated data) to test the client-server part of the system. Have you looked into the '

Using django test suite with standalone script

2008-05-01 Thread dcoy
Simply put I have a system like this (everything implemented as python scripts) * Socket server - The server receives connections from distributed clients (over GPRS). - The clients send data to the server. - The server uses django models to save the data to database. * Test client - Runs a