2011/3/29 Nathan <[email protected]> > Hi, > > I'm wondering if anybody can help with this because I'm going nuts > with it! > > I have setup a second web.py project in exactly the same way as a > working one I have with WSGI but every time I try to run it, I get > errors saying it can't find my other modules. > > It works fine under the built in web server (python code.py) > > Error and trace: > > ---------------------------------------------------------------------------------------------------------- > mod_wsgi (pid=17252): Target WSGI script '/srv/www/app/code.py' > cannot be loaded as Python module. > mod_wsgi (pid=17252): Exception occurred processing WSGI script '/srv/ > www/app/code.py'. > Traceback (most recent call last): > File > "/srv/www/app/code.py", line 18, in <module> > urls = urls + user.urls + part.urls + supplier.urls > AttributeError: 'module' object has no attribute 'urls' > Target WSGI script '/srv/www/app/code.py' cannot be loaded as Python > module. > > ---------------------------------------------------------------------------------------------------------- > TOP OF code.py > > ---------------------------------------------------------------------------------------------------------- > #!/usr/bin/python > import sys, os > abspath = os.path.dirname(__file__) > sys.path.append(abspath) > os.chdir(abspath) > > import web, db, settings, sql > import user, part, supplier >
edit you user/__init__.py, add "import urls" to it. Do the same in other __init__.py files > > urls = ( > '/', 'dashboard' > ) > urls = urls + user.urls + part.urls + supplier.urls > > app = web.application(urls, globals()) > application = app.wsgifunc() > ... > > ------------------------------------------------------------------------------------------------------------ > Each of the user, part and supplier class contain: > > ----------------------------------------------------------------------------------------------------------- > import web, db, settings, sql, > urls = ( > '/login[/]*', 'user.login', > '/logout', 'user.logout', > '/profile', 'user.profile' > ) > ... > > ------------------------------------------------------------------------------------------------------------ > > Apache is configured as: > <VirtualHost *:80> > <<SNIP SERVER LOG CONFIG ETC.. >> > > WSGIScriptAlias / /srv/www/app/code.py/ > Alias /static /srv/www/app/static/ > AddType text/html .py > <Directory /srv/www/app/> > Order deny,allow > Allow from all > </Directory> > </VirtualHost> > > > Anybody able to provide any insight to what may be causing the error? > > Many thanks. > > -- > You received this message because you are subscribed to the Google Groups > "web.py" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/webpy?hl=en. > > -- You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.
