I've added a file to the modules folder, in a controller I import this module which works fine locally (Windows). When I deploy my application to the server (linux, apache) I get the following error when I try to import my module:
File "web2pypath/gluon/custom_import.py", line 82, in custom_importer
modules_prefix, globals, locals, [itemname], level)
ImportError: No module named myapp.modules
I did not activate the custom importer (track_changes) and there is a file __init__.py (which is empty) in the modules folder. Does someone have an idea what could be wrong or what I could try to fix this?
thanks, Alex
import jasperclient
jasperclient is the module name (there is a file modules/jasperclient.py).
thanks for your help. Unfortunately I could not resolve the issue so far. I deleted all .pyc files and restarted apache, still does not work (there are no .pyc files in the modules folder now). what web2py or apache configuration could have an effect on this? are there any specific settings? web2py runs in virtualenv, could this be related with the problem somehow? I've compiled the app on my machine and deploy the compiled app on the linux server. All the compiled files are in the dir 'compiled'.
maybe offtopic - but why should I switch to nginx? performance is great and our server load is hardly measurable.
Actually I'm doing exactly this (compile app on another machine) for years now without any problems (as long as I use the same Python and web2py version on both machines). So I would be surprised if this is the reason I cannot import the module. I tried to manually compile the files in the modules folder on the server but this didn't change anything.
How are the modules working for compiled apps? Because everything else (controllers, models, views) will be compiled and stored as .pyc file in the compiled dir. Are the module files compiled on demand (on import) directly in the modules folder?
Actually I'm doing exactly this (compile app on another machine) for years now without any problems (as long as I use the same Python and web2py version on both machines). So I would be surprised if this is the reason I cannot import the module. I tried to manually compile the files in the modules folder on the server but this didn't change anything.
Are the module files compiled on demand (on import) directly in the modules folder?