|
List Info
Thread: Production environment Problem
|
|
| Production environment Problem |

|
2007-05-09 00:02:52 |
|
Hi
I am newbie to cherrypy. I am using cherrypy 2.2.0 beta. I am having problem while i run the application in the production mode.
I have the configuration file to set the environment. The file contains the following lines of code.
============================================================ webgui.conf ============================================================
[global] server.environment: "production" server.log_to_screen
= True server.log_tracebacks = True server.thread_pool: 1 session_filter.on = True error_page.404 = "/app/www/404.html" server.socket_host = "0.0.0.0" server.socket_port:
80 server.reverse_dns: False static_filter.root = "/app/www"
[/static] static_filter.on = True static_filter.dir = "static" =================================================================
I have a file named webgui and started the cherrypy server like this
=============================================================== webgui ===============================================================
Class App(): _cp_filters = [ httpauthfilter.HttpAuthFilter(realm="MyApp", privateKey="myapp", unauthorizedPath="/unauthorized", retrieveUsersFunc=retrieveAuthUsers)]
cherrypy.expose def index(self): import index return index.Render()
os.chdir('/app/bin';) cherrypy.root = App() cherrypy.config.update(file='
webgui.conf39;) cherrypy.server.start() ================================================================
I have unauthorized.kid file. It just print the login failure error message ========================================================
<html> <head> <title>ERROR: Login failed</title> </head> <body bgcolor="#ffc0cb"> <h1>ERROR: Login failure, access denied</h1> <p>Login failure, please provide correct administrator username and password
to access this web page.</p> </body> </html>
========================================================
while i run that application , I got the following error ================================================================
File "/usr/local/lib/python2.4/site-packages/kid/__init__.py", line 112, in load_template raise Exception, "Template not found: %s (in %s)" % ( Exception: Template not found: unauthorized.kid
(in /, /) ================================================================
If i run the same apllication in development mode. Its works fine.
If anything i missed in the conf file. please help me anyone.
Thanks in advance.
- Mahabub Basha.S
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group. To post to this group, send email to cherrypy-users googlegroups.com To unsubscribe from this group, send email to cherrypy-users-unsubscribe googlegroups.com For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en -~----------~----~----~----~------~----~------~--~---
|
| Re: Production environment Problem |

|
2007-05-09 07:23:38 |
On 5/9/07, Mahabub Basha <mahabubbasha gmail.com> wrote:
> Hi
>
> I am newbie to cherrypy. I am using cherrypy 2.2.0
beta. I am having problem
> while i run the application in the production mode.
[snip]
> while i run that application , I got the following
error
>
============================================================
====
> File
>
"/usr/local/lib/python2.4/site-packages/kid/__init__.py
",
> line 112, in load_template
> raise Exception, "Template not found: %s (in
%s)" % (
> Exception: Template not found: unauthorized.kid (in /,
/)
>
============================================================
====
>
> If i run the same apllication in development mode. Its
works fine.
>
> If anything i missed in the conf file. please help me
anyone.
>
> Thanks in advance.
Hmm, that sounds strange. It certainly seems like a path
issue, but I
can't explain why it would work in development mode but not
in
production mode. One thing you might try is specifying
absolute paths
to whatever you are using to render your Kid templates.
Using a
relative path is probably causing the problem.
HTH,
Christian
http://www.dowski.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users googlegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribe googlegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Production environment Problem |

|
2007-05-11 07:55:38 |
|
On 5/9/07, Christian Wyglendowski < christian dowski.com">christian dowski.com> wrote:
Hmm, that sounds strange. It certainly seems like a path issue, but I can't explain why it would work in development mode but not in production mode. One thing you might try is specifying absolute paths
to whatever you are using to render your Kid templates. Using a relative path is probably causing the problem.
Thanks christian.
I have used called the template like this in my index.py
. ==================================================== Index.kid ==================================================== page = kid.Template('Index.kid', args=args) return page.serialize()
============================================
If i used the absolute path like this page = kid.Template('/app/bin/Index.kid', args=args)
Its working fine in production environment.
I need like this
rootdir = '/app/bin/"
kid.Template( rootdir + 'Index.kid', args=args)
I have 20 or more kid files. I have to use the rootdir globally. Tomorrow if i want to change some other path. I can change only the rootdir value. I don't want to go all the kid files and changed.
where i have to define the variable, In my webgui or conf file.
Is there any predefined variable in cherrypy.?
please give me some example links.
- Mahabub Basha.S
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group. To post to this group, send email to cherrypy-users googlegroups.com To unsubscribe from this group, send email to cherrypy-users-unsubscribe googlegroups.com For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en -~----------~----~----~----~------~----~------~--~---
|
| Re: Production environment Problem |

|
2007-05-11 08:46:38 |
> On 5/9/07, Christian Wyglendowski <christian dowski.com> wrote:
> >
> > One thing you might try is specifying absolute
paths
> > to whatever you are using to render your Kid
templates. Using a
> > relative path is probably causing the problem.
On 5/11/07, Mahabub Basha <mahabubbasha gmail.com> wrote:
> If i used the absolute path like this
> page = kid.Template('/app/bin/Index.kid', args=args)
>
> Its working fine in production environment.
>
> I need like this
>
> rootdir = '/app/bin/"
> kid.Template( rootdir + 'Index.kid', args=args)
>
> I have 20 or more kid files. I have to use the rootdir
globally. Tomorrow if
> i want to change some other path. I can change only the
rootdir value. I
> don't want to go all the kid files and changed.
>
> where i have to define the variable, In my webgui or
conf file.
>
> Is there any predefined variable in cherrypy.?
>
> please give me some example links.
Well, you can set it as a "constant" in some .py
file and import it
where you setup your templates.
# settings.py
ROOTDIR = '/app/bin'
# somefile.py
import settings
import os
...
...
kid.Template(os.path.join(settings.ROOTDIR, 'Index.kid'),
args=args)
-----------
You could also stick it in your app's config file in a
special section
for your app and then get at it in the following manner:
# app.conf
[local_settings]
rootdir = '/app/bin'
# somefile.py
rootdir =
cherrypy.config.configs['local_settings']['rootdir']
kid.Template(os.path.join(rootdir, 'Index.kid'), args=args)
-------------
Either of those methods should work - pick the one that you
like best.
Good luck,
Christian
http://www.dowski.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users googlegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribe googlegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Production environment Problem |

|
2007-05-14 03:01:46 |
|
Hi
On 5/11/07, Christian Wyglendowski < christian dowski.com">christian dowski.com> wrote:
Well, you can set it as a "constant" in some .py file and import it where you setup your templates.
# settings.py ROOTDIR = '/app/bin'
# somefile.py import settings import os
... ... kid.Template(os.path.join(settings.ROOTDIR, 'Index.kid'), args=args)
----------- You could also stick it in your app's config file in a special section for your app and then get at it in the following manner:
# app.conf [local_settings] rootdir = '/app/bin'
# somefile.py rootdir = cherrypy.config.configs['local_settings'][';rootdir9;] kid.Template(os.path.join(rootdir, 'Index.kid
'), args=args)
------------- Either of those methods should work - pick the one that you like best.
Christian i tried both methods. Once again i have problem. If i run in development mode. Its working fine.
Once i changed my environment as production mode. And then run my application and clear my browser cookies and cache everything. I got an following error from my browser. ==================================================================
500 Internal error
The server encountered an unexpected condition which prevented it from fulfilling the request. =====================================================================
If i clears my browser cookies and cache , I got the above error. Even i have my
Index.pyc file.
I don't know what is going on. Almost i complete my site in development environment, If i change into production environment . I got problem.
Cherrypy is my best framework. This problem makes me uncomfortable. I am googling and study cherrypy receipes also. I can't able to solve these issue.
Is there anything mistake from my application or its a cherrypy problem.
Please help me to solve the issue.
- Mahabub Basha.S
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group. To post to this group, send email to cherrypy-users googlegroups.com To unsubscribe from this group, send email to cherrypy-users-unsubscribe googlegroups.com For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en -~----------~----~----~----~------~----~------~--~---
|
| Re: Production environment Problem |
  United Kingdom |
2007-05-14 03:06:53 |
Mahabub Basha wrote:
> Hi
>
> On 5/11/07, Christian Wyglendowski <christian dowski.com> wrote:
>>
>> Well, you can set it as a "constant" in
some .py file and import it
>> where you setup your templates.
>>
>> # settings.py
>> ROOTDIR = '/app/bin'
>>
>> # somefile.py
>> import settings
>> import os
>> ...
>> ...
>> kid.Template(os.path.join(settings.ROOTDIR,
'Index.kid'), args=args)
>>
>> -----------
>> You could also stick it in your app's config file
in a special section
>> for your app and then get at it in the following
manner:
>>
>> # app.conf
>> [local_settings]
>> rootdir = '/app/bin'
>>
>> # somefile.py
>> rootdir =
cherrypy.config.configs['local_settings']['rootdir']
>> kid.Template(os.path.join(rootdir, 'Index.kid'),
args=args)
>>
>> -------------
>> Either of those methods should work - pick the one
that you like best.
>>
>>
> Christian i tried both methods. Once again i have
problem. If i run in
> development mode. Its working fine.
>
> Once i changed my environment as production mode. And
then run my
> application and clear my browser cookies and cache
everything. I got an
> following error from my browser.
>
============================================================
======
> 500 Internal error
>
> The server encountered an unexpected condition which
prevented it from
> fulfilling the request.
>
============================================================
=========
>
> If i clears my browser cookies and cache , I got the
above error. Even i
> have my Index.pyc file.
>
> I don't know what is going on. Almost i complete my
site in development
> environment, If i change into production environment .
I got problem.
>
> Cherrypy is my best framework. This problem makes me
uncomfortable. I am
> googling and study cherrypy receipes also. I can't able
to solve these
> issue.
>
> Is there anything mistake from my application or its a
cherrypy problem.
>
> Please help me to solve the issue.
>
Hi,
Could you paste a better traceback if you have one when you
run into the
problem in production mode?
Thanks,
- Sylvain
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users googlegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribe googlegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Production environment Problem |

|
2007-05-14 04:41:51 |
|
Hi,
On 5/14/07, Sylvain Hellegouarch < sh defuze.org">sh defuze.org> wrote:
Hi,
Could you paste a better traceback if you have one when you run into the problem in production mode? ====================================================================
Traceb ack (most recent call last): File "/usr/local/lib/python2.4/site-packages/cherrypy/_cphttptools.py", line 105, in _run self.main() File "/usr/local/lib/python2.4/site-packages/cherrypy/_cphttptools.py", line 254, in main
body = page_handler(*virtual_path, **self.params) File "/app/bin/webgui", line 288, in unauthorized page = kid.Template('unauthorized.kid') File "/usr/local/lib/python2.4/site-packages/kid/__init__.py", line 159, in Template
mod = load_template(file) File "/usr/local/lib/python2.4/site-packages/kid/__init__.py", line 112, in load_template raise Exception, "Template not found: %s (in %s)" % ( Exception: Template not found:
unauthorized.kid (in /, /) =====================================================================
I am using cherrypy 2.2.0 beta. I am running the cherrypy in FreeBSD 6.1.
Thanks in Advance.
- Mahabub
Basha.S
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group. To post to this group, send email to cherrypy-users googlegroups.com To unsubscribe from this group, send email to cherrypy-users-unsubscribe googlegroups.com For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en -~----------~----~----~----~------~----~------~--~---
|
| Re: Production environment Problem |

|
2007-05-17 07:54:37 |
|
Hi
Christian thanks a lot.
Accidentally i got the solution. Now i have no problem in production mode. That day itself i tried your both methods. Its not working. Suddenly I tried that again using this following method.
================================================================== # settings.py ROOTDIR = '/app/bin'
# somefile.py import settings import os
... ... kid.Template(os.path.join(settings.ROOTDIR, 'Index.kid'), args=args) ===================================================================
Cherrypy rocks.
Thank you very much.
- Mahabub Basha.S
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group. To post to this group, send email to cherrypy-users googlegroups.com To unsubscribe from this group, send email to cherrypy-users-unsubscribe googlegroups.com For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en -~----------~----~----~----~------~----~------~--~---
|
| Re: Production environment Problem |

|
2007-05-17 08:15:23 |
On 5/17/07, Mahabub Basha <mahabubbasha gmail.com> wrote:
> Christian thanks a lot.
>
> Accidentally i got the solution.
[snip]
> Cherrypy rocks.
>
> Thank you very much.
Excellent. Glad you got it working!
Christian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users googlegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribe googlegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
[1-9]
|
|