Repository: google/personfinder

Issue:
Load third party libraries with PIP
We should probably follow "Using pip requirements files" section here to install third-party libraries:
https://cloud.google.com/appengine/docs/python/tools/using-libraries-python-27
instead of directly putting third party library *.py files under "app" directory.



Discussion:
@gimite I'd like to take this up. Could you provide a bit more info on how to go about it?

That would be great! Can you follow "Installing a third-party library" section in the document linked above to install babel, pytz, recaptcha, simplejson, unidecode and xlrd? They are currently put directly under "app" directory. (Not sure if all of them are provided with PIP. You can leave those not provided with PIP for now.)

In Person Finder, "app" is the root directory for AppEngine (where app.yaml is located), so probably everything should be under "app" e.g., the library directory should be app/lib. Let me know if you have any question following the instruction.

@gimite Thanks for the info! I'm working on it.

@gimite I've run into a bit of an issue. I've gone through the following steps -
- Moved the `babel`, `pytz`, `simplejson`, `unidecode`, `xlrd`, `recaptcha` and `babel` folders from `app/` to `app/lib/`
- Created the `requirements.txt` file using `pip freeze` to get the required dependency info.
- Created the `appengine_config.py` file under `app/`

However, after I've started the app using `tools/gae run app --port=8000`, every time I try to access `localhost:8000` I run into import errors from the missing libraries. Somehow the configuration in `appengine_config.py` is not getting applied to import the libraries from the `app/lib/` folder.

Hm I don't know why. Can you push your change to Github and point me the URL of the repository so that I can take a look?

Maybe you should reinstall the libraries with "pip install" command as instructed in the doc instead of just moving them from app/ directory. I'm not sure but the expected directory structure may be different.

I tried reinstalling using `pip install` but pip just returns the `requirement already satisfied` message saying the library is present in `usr/bin.....`

I'll just push my changes now.

Maybe this issue?:
http://stackoverflow.com/questions/25990036/dev-appserver-py-doesnt-load-appengine-config-py

Note that, to make the suggested change in the answer in the page, you also need to modify app/main.py to support a new way to point to the script.

Hey, I am working on this issue also. I wondering if it is a good idea to update directly the `Dockerfile`, thus, each contributors will be able to run the entire project without install any dependencies on his own computer (assume docker-engine is installed). 
In this `Dockerfile` we could be able to create app/lib directory then install each dependencies inside this lib with `requirements.txt` file.
So we should remove `easy_install` from `Dockerfile`, install `python-pip` then install `requirements.txt` which one produce by `pip freeze`. 
It is just an idea to improve development stack...
One problem is that there are many contributors who don't use Docker setup as a main environment (including me). Updating Dockerfile sounds good, but we also want to keep non-Docker setup easy.

Resolving patch:
diff --git a/app/main.py b/app/main.py
--- a/app/main.py
+++ b/app/main.py
@@ -21,6 +21,9 @@
 import mimetypes
 import re
 import os
+import sys
+sys.path.append(os.path.join(os.path.dirname(__file__), 'vendors'))
+
 import urlparse
 
 from google.appengine.api import memcache
@@ -597,4 +600,4 @@ def head(self):
 
 if __name__ == '__main__':
     webapp.util.run_wsgi_app(webapp.WSGIApplication([('.*', Main)]))
-    
\ No newline at end of file
+    


Test patch: