Reputation: 61
I am writing a GAE application and have run into an import problem.
My app.yaml
has the following lines:
- url: /py/classes/
static_dir: py/classes
- url: /py/lib
static_dir: py/lib
- url: /py/bin/signin
script: py/bin/signin.py
I am keeping a python file, titled employee.py, containing the class employee, in the classes folder, and a signin.py script in the bin folder which tries - at the moment unsuccessfully - to import the employee class. I have tried, amongst others:
import employee
import py.classes.employee
Neither option works. Could you please let me know what I am doing wrong?
Thank you in advance.
Upvotes: 2
Views: 365
Reputation: 101149
Any files specified as static files get uploaded separately from your code - they're not accessible by your Python code, so even with the PYTHONPATH set correctly, you won't be able to import them.
Upvotes: 1
Reputation:
The static_dir
configuration option can not be used to extend PYTHONPATH
. Using it you can serve static files like images, stylesheet, or Javascript files.
If you want to use normal Python modules just put them next to your main Python files.
Edit:
Are your directories Python packages that include the necessary __init__.py
files?
Upvotes: 3