简体   繁体   中英

How to package a Pycharm python project for upload to AWS Lambda?

Using pycharm on Windows.

I have created a zip file for upload to AWS Lambda the manual way: 1) Install the modules manually into a directory other than the default directory. 2) Create my .py code file 3) Zip the contents of the project folder 4) Upload that zip folder to Lambda

I am new to Pycharm and with a project I see that there are a whole bunch of files and folders that I do not understand.

I tried to zip the entire Pycharm project contents and upload - that did not work. It looks like I need to run some kind of setup that creates the proper folder structure and files that have the correct content.

Any help would be appreciated.

For all those still stuck with this, I have a few suggestions which could possibly resolve the issue altogether:

  • Use pip's -t option to specify the Application Directory

    Using Pip's -t option, one can specify the Application directory. It's better than using the pycharm's package installer, as we can specify the installation directory with this.

  • Zip the complete Application directory ( Answer's your question )

    Go inside your Pycharm project directory -> select all -> Right Click -> send to compressed (zip). This may result in the inclusion of some unneeded directories (__pycache__, .idea), but would not affect the program execution. If needed, you may skip those two directories while creating the zip.

I believe you were zipping the project directory, rather than compressing the contents of the Project directory.

As I also answered here Jetbrains now offers the AWS Toolkit which allows local and remote development of Lambda functions.

Despite some lingering issues it works quite well. Still finding my way with it.

It includes packaging and deploying.

Toolkit page on Jetbrains website

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM