使用模块将项目部署到GAE Flex

时间:2017-02-10 13:24:46

标签: python python-3.x google-app-engine module

我有一个具有以下结构的Flask项目:

- /
  - app.yaml
  - app/
    - __init__.py
    - main.py (imports 'helper')
    - helper.py

main.py执行import helper。在本地我通过从根目录执行python app/main.py来运行应用程序,一切都很顺利。

但是,当我运行gcloud app deploy app.yaml时,我得到ImportError: No module named 'helper'

我如何'注册'helper以便部署?

1 个答案:

答案 0 :(得分:0)

现在执行应用程序的方式是不将<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <com.example.anthony.myapplication.wizard.ItemWizardEditTextView android:id="@+id/name" android:layout_width="match_parent" android:layout_height="wrap_content" app:title="NOM"/> <com.example.anthony.myapplication.wizard.ItemWizardEditTextView android:id="@+id/brand1" android:layout_width="match_parent" android:layout_height="wrap_content" app:title="MARQUE 1"/> <com.example.anthony.myapplication.wizard.ItemWizardEditTextView android:id="@+id/brand2" android:layout_width="match_parent" android:layout_height="wrap_content" app:title="MARQUE 2"/> <com.example.anthony.myapplication.wizard.ItemWizardEditTextView android:id="@+id/brand3" android:layout_width="match_parent" android:layout_height="wrap_content" app:title="MARQUE 3"/> </LinearLayout> 作为模块加载,它只是将app作为独立文件执行,并带有'。'指向模块的顶部目录,而不是app/main.py存在的位置。因此错误。

您的helper.py(被调用来执行您的应用)应与main.py文件并排(标识您的应用/服务顶级目录)。从app.yaml开始,您可以根据需要加载/调用模块,例如通过main.py