UrlConf problem when capture value from url

2012-04-20 Thread DanYun Liu
When I use url pattern like this "/search/(\s+)","myview" : django will set
mydomain/search as the root domain, so the css and js will not request
correctly:

in my template:


the request url for the index.css  is:
http://mydomain/search/styles/index.css but not:
http://mydomain/styles/index.css

is there any solution?


-- 
Pursuit the freedom of the soul.

-- 
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: UrlConf problem when capture value from url

2012-04-20 Thread DanYun Liu
yes, it works well :)

On Fri, Apr 20, 2012 at 10:11 PM, Daniel Sokolowski <
daniel.sokolow...@klinsight.com> wrote:

>   Yes {{STATIC_URL}} -
> https://docs.djangoproject.com/en/dev/howto/static-files/#using-django-contrib-staticfiles
>
> 
>
> Does that help?
>   *From:* DanYun Liu 
> *Sent:* Friday, April 20, 2012 8:57 AM
> *To:* django-users@googlegroups.com
> *Subject:* UrlConf problem when capture value from url
>
> When I use url pattern like this "/search/(\s+)","myview" : django will
> set mydomain/search as the root domain, so the css and js will not request
> correctly:
>
> in my template:
> 
>
> the request url for the index.css  is:
> http://mydomain/search/styles/index.css but not:
> http://mydomain/styles/index.css
>
> is there any solution?
>
>
> --
> Pursuit the freedom of the soul.
> --
> 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.
> Daniel Sokolowski
> Web Engineer
> KL Insight
> http://klinsight.com/
> Tel: 613-344-2116 | Fax: 613.634.7029
> 993 Princess Street, Suite 212
> Kingston, ON K7L 1H3, Canada
>
>
> Notice of Confidentiality:
> The information transmitted is intended only for the person or entity to
> which it is addressed and may contain confidential and/or privileged
> material. Any review re-transmission dissemination or other use of or
> taking of any action in reliance upon this information by persons or
> entities other than the intended recipient is prohibited. If you received
> this in error please contact the sender immediately by return electronic
> transmission and then immediately delete this transmission including all
> attachments without copying distributing or disclosing same.
>
> --
> 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.
>



-- 
Pursuit the freedom of the soul.

-- 
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.



why django document does not specify how to use non-global middleware

2012-04-25 Thread DanYun Liu
I am new to django, before django I used struts2 to build web application.
It is common that we need to apply some middleware to a part of views and
others not. I didn't find any userful information on the django site, so I
searched the stackoverflow and got the right answer.

http://stackoverflow.com/questions/2916966/non-global-middleware-in-django

I will be useful to people who is familiar struts but new to django  to
include how to user non-global middleware when introuduce the midlleware.


-- 
Pursuit the freedom of the soul.

-- 
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.



how to get the variable in the context

2012-04-28 Thread DanYun Liu
I defined a context processor to pass the login user info to the template.
and, I also need to use it in the view.

is there any way to get the variable from the context?

-- 
Pursuit the freedom of the soul.

-- 
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: Parent module does not exist

2012-05-26 Thread DanYun Liu
does wikicamp is your working directory?  try  to make wikicamp as a
package to add __init__.py

On Sun, May 27, 2012 at 11:45 AM, Ali Shaikh  wrote:

> Hello!!
>
>
> ViewDoesNotExist at /wikicamp/start/
> Could not import wikicamp.views.view_page. Parent module
> wikicamp.views does not exist.
> Request Method: GET
> Request URL:http://localhost:8000/wikicamp/start/
> Django Version: 1.4
> Exception Type: ViewDoesNotExist
> Exception Value:
> Could not import wikicamp.views.view_page. Parent module
> wikicamp.views does not exist.
> Exception Location: /usr/local/lib/python2.6/dist-packages/django/core/
> urlresolvers.py in get_callable, line 108
> Python Executable:  /usr/bin/python
> Python Version: 2.6.6
> Python Path:
> ['/home/tanveer/djcode/wikicamp',
>  '/usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg',
>  '/usr/local/lib/python2.6/dist-packages/pip-1.0-py2.6.egg',
>  '/usr/lib/python2.6',
>  '/usr/lib/python2.6/plat-linux2',
>  '/usr/lib/python2.6/lib-tk',
>  '/usr/lib/python2.6/lib-old',
>  '/usr/lib/python2.6/lib-dynload',
>  '/usr/local/lib/python2.6/dist-packages',
>  '/usr/lib/python2.6/dist-packages',
>  '/usr/lib/pymodules/python2.6',
>  '/usr/lib/pymodules/python2.6/gtk-2.0']
> Server time:Sat, 26 May 2012 22:35:01 -0500
>
>
> I spend lot of time for this,but I dint get where am going wrong .:
> (
> Pls help.:(
>
> Thank You
>
> --
> 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.
>
>


-- 
Pursuit the freedom of the soul.

-- 
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.



The idle process does not destroy when request finished

2012-07-26 Thread DanYun Liu
As the visit user is growing fast, I switch the method=threaded to
method=prefork to handle more quest. But the service then become not
available sometimes, I found that one or two processes were created  every
minute and the old ones  still here with CPU usage 0%, idled.

I don't have any idea where I can debug the problem, can anyone share some
suggestions?

thanks

-- 
Pursuit the freedom of the soul.

-- 
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.



log file will be overwrite when use prefork?

2012-08-09 Thread DanYun Liu
below is the logging config in setting.py.  only the newest logs in the
output file.. It seems the log file is overwrite when new process been
forked

LOGGING = {
'version': 1,
'disable_existing_loggers': False,

'formatters': {
'standard': {
'format': '%(levelname)s %(asctime)s %(module)s %(lineno)d
%(message)s'
},
'detail': {
'format': '%(levelname)s %(asctime)s %(pathname)s %(lineno)d
%(message)s'
}
},
'handlers': {
'frontend': {
'level': 'INFO',
'formatter': "standard",
'class': 'logging.handlers.TimedRotatingFileHandler',
'when': 'MIDNIGHT',
'filename': '/deploy/logs/log.txt'
},
'error': {
'level': 'INFO',
'formatter': "detail",
'class': 'logging.handlers.TimedRotatingFileHandler',
'when': 'MIDNIGHT',
'filename': '/deploy/logs/error.txt'
},
'stat': {
'level': 'INFO',
'formatter': "standard",
'class': 'logging.handlers.TimedRotatingFileHandler',
'when': 'MIDNIGHT',
'filename': '/deploy/logs/stat.txt'
}
},
'loggers': {
'frontend': {
'handlers': ['frontend'],
'level': 'INFO',
'propagate': True,
},
'error': {
'handlers': ['error'],
'level': 'INFO',
'propagate': True,
},
'stat': {
'handlers': ['stat'],
'level': 'INFO',
'propagate': True,
},
}
}



-- 
Pursuit the freedom of the soul.

-- 
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.