简体   繁体   English

importError:没有名为Coreapp的模块(Flask和Google App Engine)

[英]importError: No module named Coreapp (Flask and Google App Engine)

I'm trying to run and deploy my web app on my local server. 我正在尝试在我的本地服务器上运行和部署我的Web应用程序。 I'm learning how to use google app engine and when I command dev_appserver.py flaskapp one directory above flaskapp but inside my repo, I get this error: 我正在学习如何使用谷歌应用程序引擎,当我命令dev_appserver.py flaskapp一个目录上面的flaskapp但在我的回购中,我收到此错误:

uzuki@ubuntu:~/hw3p1s13$ ~/Downloads/google_appengine/dev_appserver.py flaskapp/
INFO     2013-03-18 03:43:12,890 appcfg.py:618] Checking for updates to the SDK.
INFO     2013-03-18 03:43:13,398 appcfg.py:636] The SDK is up to date.
WARNING  2013-03-18 03:43:13,398 dev_appserver.py:3578] The datastore file stub is    deprecated, and
will stop being the default in a future release.
Append the --use_sqlite flag to use the new SQLite stub.

 You can port your existing data using the --port_sqlite_data flag or
 purge your previous test data with --clear_datastore.

 WARNING  2013-03-18 03:43:13,400 datastore_file_stub.py:528] Could not read datastore      data from /tmp/dev_appserver.datastore
 WARNING  2013-03-18 03:43:13,618 simple_search_stub.py:975] Could not read search   indexes from /tmp/dev_appserver.searchindexes
 INFO     2013-03-18 03:43:14,431 dev_appserver_multiprocess.py:656] Running application dev~robohw27 on port 8080:     http://localhost:8080
 INFO     2013-03-18 03:43:14,432 dev_appserver_multiprocess.py:658] Admin console is available at:     http://localhost:8080/_ah/admin
 ERROR    2013-03-18 03:44:05,236 wsgi.py:219] 
 Traceback (most recent call last):
 File "/home/uzuki/Downloads/google_appengine/google/appengine/runtime/wsgi.py", line 196, in Handle
 handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
 File "/home/uzuki/Downloads/google_appengine/google/appengine/runtime/wsgi.py", line 255, in _LoadHandler
handler = __import__(path[0])
ImportError: No module named coreapp
INFO     2013-03-18 03:44:05,265 dev_appserver.py:3104] "GET / HTTP/1.1" 500 -
ERROR    2013-03-18 03:44:07,858 wsgi.py:219] 

The strange thing is I do have directory called coreapp that contains two files, __init__.py and views.py. 奇怪的是我的目录名为coreapp,包含两个文件__init__.py和views.py。 The __init__.py folder contains __init__.py文件夹包含

from flask import Flask
app = Flask('coreapp')
import views 

and my views.py file handles an HTTP request made to a particular URL. 我的views.py文件处理对特定URL的HTTP请求。 To sum it up, it does contain from coreapp import app . 总结一下,它确实包含from coreapp import app So I'm not sure what I'm doing wrong ?? 所以我不确定我做错了什么?

Just to add, in my app.yaml file inside my flaskapp directory, it contains: 只是添加,在我的flaskapp目录中的app.yaml文件中,它包含:

handlers
- url: .*
script : coreapp.app 

EDIT: 编辑:

Hello everyone. 大家好。 I figured out my problem, it's so foolish: 我想出了我的问题,这太愚蠢了:

I wanted " __init__.py " but I had " __int__.py ". 我想要“ __init__.py ”,但我有“ __int__.py ”。 (Major typo!) (主要错字!)

Also, I was just gedit editor in my views.py file. 另外,我只是我的views.py文件中的gedit编辑器。 But I had white space and wrong apostrophes. 但我有白色空间和错误的撇号。 Please let me know if anyone else is having a similar problem. 如果其他人遇到类似的问题,请告诉我。

Thank you! 谢谢! I will answer my own question in 6 hours lol. 我将在6小时内回答我自己的问题。

I figured out my problem, it's so foolish: 我想出了我的问题,这太愚蠢了:

I wanted " __init__ ".py" but I had " __int__.py ". (Major typo!) 我想要“ __init__ ”. __int__.py “但我有” __int__.py . __int__.py “。(主要错字!)

Also, I was just gedit editor in my views.py file. 另外,我只是我的views.py文件中的gedit编辑器。 But I had white space and wrong apostrophes. 但我有白色空间和错误的撇号。 Please let me know if anyone else is having a similar problem. 如果其他人遇到类似的问题,请告诉我。

import sys
sys.path.append(whereever_coreapp_is)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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