我有一个具有以下结构的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
以便部署?
答案 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
。