I am working on a project in which i want to integrate stripe for payments. I am following their documentation to integrate it in python Stripe Documentation. In documentation they downloaded the stripe library to use it. The code to download it was:
pip install --upgrade stripe
I followed the same steps. But i am getting this error. When i try to import it in my project.
import stripe
ImportError: No module named stripe
When you pip installed stripe, it installed it in your local system. But GAE does not have that package, so you cannot simply import it in production. You need to download the package, and add it inside your app. For example, in a "libs" directory. Then, it will upload with the rest of your app when you deploy, and be available to the app. Then, you import it like this:
Assuming your app structure looks like this:
The proper way to install a 3rd party library into your GAE application is described in Installing a library:
Notes:
When going through the mentioned doc page pay attention as it also contains instructions for requesting and using GAE-provided built-in libraries - different than those for installed/vendored-in libraries.
if your app is a multi-module one you'll need an
appengine_config.py
for each module using the library at step#3, located beside the module's.yaml
file. It can be symlinked for DRY reasons if you prefer (see https://stackoverflow.com/a/34291789/4495081).step #4's goal is to just bring the content of the stripe library in a subdirectory of the
lib
dir. You can do that manually if the pip way fails for whatever reason.