So long as the WSGI script file used as the entry point has source code, then .pyc files for other code should be fine.
Things which could cause problems are: 1. .pyc files are from a different major/minor version of Python. 2. the .pyc files aren't readable to the user that code under Apache/mod_wsgi is running as. What I suggest you do is setup WSGI script file as hello world program. In that set sys.path appropriately and then do explicit import of the module which is giving you problems. In other words, divorce yourself from your particular Python web framework you are using. BTW, what framework are you using? The framework in itself may be the issue. Django is one case where imports often work under Django development server and not under a production environment because of issues with module import order or cycles. Under Django development server they may not show because it force preloads a lot of stuff where as production WSGI deployment recipe for Django does lazy loading. One can sometimes tell whether this is the issue if you supply the actual import error messages which shows what was being imported and whether it failed on importing from root or a sub import. Graham On 15 March 2011 13:24, FC <[email protected]> wrote: > Hi, I'm trying to migrate to wsgi but I'm getting ImportError > exceptions all the time. > > I have my modules installed only with .pyc files, I don't have the .py > files in the server (I can't change that, sorry). When I add some .py > files the ImportError moves away to some other import line. > > Is there a way to make WSGI use the .pyc files and work without > the .py? > > The script with the application entry point is a .py file but it > imports some modules which are .pyc > > Thanks for your help > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" 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/modwsgi?hl=en. > > -- You received this message because you are subscribed to the Google Groups "modwsgi" 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/modwsgi?hl=en.
