I just want to make clear that while in windows, works fine, but when I try to deploy this script in my VPS it fails.
It is kind of weird because if I add a mapping to the main web application instance which is “mainwebapp” it works, but whenever I add it to any sub application it appears as webpy “Not Found” , I am banging my head against the wall because of this.
In windows I have Wamp 2.2. in my Vps I have CentOS 5, nginx with uWsgi and same Python(2.7) & Webpy Versions from my windows.
I am almost sure that this is a problem with nginx/uwsgi because when I switch to apache/mod_wsgi in my Vps it also works as in my Wamp local server.
So far this is the code I have been testing, it is a very simple one:
class subappcls:
def GET(self):
return "This will also be shown fine"
sub_mappings = (
"/subpath", subappcls
)
#subclass web app
subwebapp = web.application( sub_mappings, globals() )
#mapped clas
class mapped_cls:
def GET(self):
return "this mapped sub app will not be found"
#Here I add mappings:
subwebapp.add_mapping("/mapped_sub_path", mapped_cls
class appcls:
def GET(self):
return "main app"
main_mappings = (
"/subapp", subwebapp,
"/app", appcls
)
mainwebapp = web.application( main_mappings, fvars=globals() )
class indexcls:
def GET(self):
return "this will be shown just fine"
mainwebapp.add_mapping("/another",indexcls)
application = mainwebapp.wsgifunc()
When I access:
/subapp/subpath #will work
/subapp/mapped_sub_path #will not work
This will work just fine:
/app
/another
This is the uwsgi log:
* Starting uWSGI 1.3 (64bit) on [Tue Dec 4 18:41:52 2012]
compiled with version: 4.1.2 20080704 (Red Hat 4.1.2-52) on 24 November 2012 02: 21:31
os: Linux-2.6.18-194.17.4.el5xen #1 SMP Mon Oct 25 16:36:31 EDT 2010
WARNING: you are running uWSGI as root !!! (use the –uid flag)
your processes number limit is 32832
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
uwsgi socket 0 bound to UNIX address /tmp/app.sock fd 3
Python version: 2.7.3 (default, Oct 30 2012, 06:37:20) [GCC 4.1.2 20080704 (Red Hat 4.1.2-52)]
Python threads support is disabled. You can enable it with –enable-threads *
EDIT: I enabled threads with the –enable-threads param and did not work either.
Thanks in advance.
The problem appears to be with reloader. The following code works if run in integrated dev server (with command
python code.py):Running curl: