django version 1.5 development server is more slow than early version

2013-03-03 Thread Fangzx
It is very obvious when I press F5 to refresh whole index page.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Custom Command as cron

2009-09-27 Thread Fangzx

Hi, I used ubuntu crontab to exec python script in my project.

1. In crontab, you can do  like this:

DJANGO_SETTINGS_MODULE=divo3.settings
PYTHONPATH=/root/deploy

# m h  dom mon dow   command
50 * * * * python /root/deploy/divo3/job.py

2. The job.py file must put in the root dir of django project, its
content like this:

#coding=utf-8
from apps.check.views.job import do_check_job
from apps.board.views.job import do_board_job
from apps.core.views.job import do_core_job
from apps.xf.views.job import do_xf_job
from apps.utils.log import log_error

if __name__ == "__main__":
do_core_job()
do_board_job()
do_check_job()
do_xf_job()

#EOP


On 9月25日, 上午1时15分, Matt McCants  wrote:
> I knew this would happen as soon as I hit submit to make a fool of
> myself.
>
> So I tried to use:
> manage.py custom_command_name --pythonpath='/path/to/my/project'
>
> but that had not worked either. The real path to the project is:
>
> /home/webdev/django/fls
>
> but I failed to put in:
>
> manage.py custom_command_name --pythonpath='/home/webdev/django'
>
> seems to have done the trick. As I said, I'm fairly new to Django and
> Python. I understand why I was wrong. Thanks for reading anyway!
>
> Matt
>
>
>
>
>
>
>
> On Thu, 2009-09-24 at 13:05 -0400, Matt McCants wrote:
> > Greetings all,
>
> > I'm having an issue running a custom command as a cron. Most resources
> > I've read have said that you can run your command from cron by simply
> > using the following syntax:
>
> > python manage.py custom_command_name
>
> > Frustratingly, that does not work for me. It results in "Unknown
> > command: 'custom_command_name'" Further attempts such as:
>
> > /usr/bin/python /path/to/my/project/manage.py custom_command_name
>
> > or any variation fail. If I run:
>
> > python /path/to/my/project/manage.py help
>
> > It executes, but my custom command does not show up.
>
> > The custom command works fine when I call it from within the project
> > directory.
>
> > I suspect it has something to do with PythonPaths. I'm pretty new to
> > both Django and Python, so any help is greatly appreciated.
>
> > Thanks,
> > Matt McCants
>
> > This message is confidential, intended only for the named recipient(s) and 
> > may contain information that is privileged or exempt from disclosure under 
> > law. If you are not the intended recipient(s), you are notified that the 
> > dissemination, distribution, or copying of this message is strictly 
> > prohibited, and that this message should be deleted from your system. The 
> > Free Lance-Star Publishing Company accepts no liability for the content of 
> > this message, or for the consequences of any actions taken on the basis of 
> > the information provided. If you receive this message in error, or are not 
> > the named recipient(s), please notify the sender and delete the document 
> > from your computer.
>
> This message is confidential, intended only for the named recipient(s) and 
> may contain information that is privileged or exempt from disclosure under 
> law. If you are not the intended recipient(s), you are notified that the 
> dissemination, distribution, or copying of this message is strictly 
> prohibited, and that this message should be deleted from your system. The 
> Free Lance-Star Publishing Company accepts no liability for the content of 
> this message, or for the consequences of any actions taken on the basis of 
> the information provided. If you receive this message in error, or are not 
> the named recipient(s), please notify the sender and delete the document from 
> your computer.
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



cmemcache with large dataset cause CPU 100%

2009-09-23 Thread Fangzx

I run my django project in Ubuntu + Ligthttpd + fastcgi + cmemcached
0.95, I found that sometimes the CPU usage reached 100% by python
process , and now I belive it caused by my program of storing large
dataset into memcached!

I changed my program to store  large dataset into file-cache like this
instead:

cache = get_cache(settings.FILE_CACHE_URI)
# FILE_CACHE_URI = 'file://D:\dev\cache3?timeout=3


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Views triggering twice

2009-01-06 Thread Fangzx

I have encountered the same problem, and after reading the content
above, I solved the problem.

It caused by the following line in my html template:

  

I replaced with:

  

Thanks for all.

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Internal server error upgarding from 0.97 to 1.0

2008-09-14 Thread Fangzx

hi,Haku,I have solved the problem:

 old code 
from django.newforms.fields import Field

--- change to new code ---
from django.forms.fields import Field

search all code, replace django.newforms with django.forms!

On 9月9日, 下午11时39分, Haku <[EMAIL PROTECTED]> wrote:
> Hello, i'm quite frustrated by this problem.
> Today i had the  idea to update my svn from the old 0.97 to the1.0
> release, and now nothing is working anymore.
>
> I always get an anonymous "InternalServerError"
> Maybe because my project included mptt, but the fact is that i cant
> figure out why it is crashing. Seems like it's the slug fields but i
> don't really know.
>
> Is there a solution? Or maybe, how can i return to my loved 0.97
> version?
>
> Sorry for the dumb questions and the bad english!
>
> --- IF THIS CAN HELP, THIS IS THE ERRORS I GET FROM THE LOG FILE
> [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101]
> PythonHandler django.core.handlers.modpython: Traceback (most recent
> call last):
> [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101]
> PythonHandler django.core.handlers.modpython:   File "/usr/lib/
> python2.4/site-packages/mod_python/apache.py", line 299, in
> HandlerDispatch\nresult = object(req)
> [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101]
> PythonHandler django.core.handlers.modpython:   File "/usr/lib/
> python2.4/site-packages/django/core/handlers/modpython.py", line 222,
> in handler\nreturn ModPythonHandler()(req)
> [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101]
> PythonHandler django.core.handlers.modpython:   File "/usr/lib/
> python2.4/site-packages/django/core/handlers/modpython.py", line 195,
> in __call__\nresponse = self.get_response(request)
> [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101]
> PythonHandler django.core.handlers.modpython:   File "/usr/lib/
> python2.4/site-packages/django/core/handlers/base.py", line 67, in
> get_response\nresponse = middleware_method(request)
> [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101]
> PythonHandler django.core.handlers.modpython:   File "/home/django/
> intranet_pini/../intranet_pini/middleware/threadlocals.py", line 12,
> in process_request\n_thread_locals.user = getattr(request, 'user',
> None)
> [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101]
> PythonHandler django.core.handlers.modpython:   File "/usr/lib/
> python2.4/site-packages/django/contrib/auth/middleware.py", line 5, in
> __get__\nrequest._cached_user = get_user(request)
> [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101]
> PythonHandler django.core.handlers.modpython:   File "/usr/lib/
> python2.4/site-packages/django/contrib/auth/__init__.py", line 83, in
> get_user\nuser_id = request.session[SESSION_KEY]
> [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101]
> PythonHandler django.core.handlers.modpython:   File "/usr/lib/
> python2.4/site-packages/django/contrib/sessions/backends/base.py",
> line 46, in __getitem__\nreturn self._session[key]
> [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101]
> PythonHandler django.core.handlers.modpython:   File "/usr/lib/
> python2.4/site-packages/django/contrib/sessions/backends/base.py",
> line 172, in _get_session\nself._session_cache = self.load()
> [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101]
> PythonHandler django.core.handlers.modpython:   File "/usr/lib/
> python2.4/site-packages/django/contrib/sessions/backends/db.py", line
> 16, in load\nexpire_date__gt=datetime.datetime.now()
> [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101]
> PythonHandler django.core.handlers.modpython:   File "/usr/lib/
> python2.4/site-packages/django/db/models/manager.py", line 93, in get
> \nreturn self.get_query_set().get(*args, **kwargs)
> [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101]
> PythonHandler django.core.handlers.modpython:   File "/usr/lib/
> python2.4/site-packages/django/db/models/query.py", line 297, in get
> \nclone = self.filter(*args, **kwargs)
> [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101]
> PythonHandler django.core.handlers.modpython:   File "/usr/lib/
> python2.4/site-packages/django/db/models/query.py", line 483, in filter
> \nreturn self._filter_or_exclude(False, *args, **kwargs)
> [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101]
> PythonHandler django.core.handlers.modpython:   File "/usr/lib/
> python2.4/site-packages/django/db/models/query.py", line 501, in
> _filter_or_exclude\nclone.query.add_q(Q(*args, **kwargs))
> [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101]
> PythonHandler django.core.handlers.modpython:   File "/usr/lib/
> python2.4/site-packages/django/db/models/sql/query.py", line 1224, in
> add_q\ncan_reuse=used_aliases)
> [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101]
> PythonHandler django.core.handlers.modpython:   File "/usr/lib/
> python2.4/site-packages/django/db/models/sql/query.py", line 1099, in