eve 应用程序部署错误谁能帮我修复它 [英] eve app deployment errors can anyone help me to fix it
问题描述
[Sat Apr 09 18:27:29.953008 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] mod_wsgi (pid=las/WSGI)/FlaskApps.wsgi' 无法作为 Python 模块加载.
[Sat Apr 09 18:27:29.953045 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] 发生 mod_wsgi0 (pid/WSGI32) 异常处理脚本/FlaskApps/FlaskApps.wsgi'.
[Sat Apr 09 18:27:29.953065 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] 回溯(最近一次通话):
[Sat Apr 09 18:27:29.953079 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] 文件/var/www.flask"在
[Sat Apr 09 18:27:29.953126 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] from run import app as application
[Sat Apr 09 18:27:29.953136 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] File "/var/www/enderPlaskr28、在
[Sat Apr 09 18:27:29.953165 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] app = Eve()
[Sat Apr 09 18:27:29.953173 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] 文件/usr/local/lib/sist"eve/flaskapp.py",第 139 行,在 init
中[Sat Apr 09 18:27:29.953371 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] self.validate_domain_struct()
[Sat Apr 09 18:27:29.953382 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] 文件/usr/local/lib/sist"eve/flaskapp.py",第 252 行,在 validate_domain_struct 中
[Sat Apr 09 18:27:29.953395 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] 引发 ConfigException(' wrong.DOMAIN)
字典丢失[Sat Apr 09 18:27:29.953408 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] ConfigException: DOMAIN 字典丢失或错误.
home.py 文件
# -*- 编码:utf-8 -*-导入操作系统从夏娃进口夏娃如果 os.environ 中的端口":port = int(os.environ.get('PORT'))主机 = '0.0.0.0'别的:端口 = 5000主机 = '127.0.0.1'app = 夏娃()如果 __name__ == '__main__':app.run(主机=主机,端口=端口)
settins.py 文件
导入操作系统MONGO_HOST = os.environ.get('MONGO_HOST', 'localhost')MONGO_PORT = os.environ.get('MONGO_PORT', 27017)MONGO_USERNAME = os.environ.get('MONGO_USERNAME', 'user')MONGO_PASSWORD = os.environ.get('MONGO_PASSWORD', '用户')MONGO_DBNAME = os.environ.get('MONGO_DBNAME', 'evedemo')RESOURCE_METHODS = ['GET', 'POST', 'DELETE']ITEM_METHODS = ['GET', 'PATCH', 'DELETE']CACHE_CONTROL = 'max-age=20'CACHE_EXPIRES = 20人 = {# 商品链接中使用的title"标签.'item_title': '人','additional_lookup':{'url': 'regex("[\w]+")','字段':'姓氏'},架构":{'名': {'类型':'字符串','最小长度':1,'最大长度':10,},'姓': {'类型':'字符串','最小长度':1,'最大长度':15,'必需':对,},'角色': {'类型':'列表','允许':[作者",贡献者",复制"],},# 嵌入的强类型"字典.'地点': {'类型':'字典',架构":{'地址':{'类型':'字符串'},'城市':{'类型':'字符串'}},},'出生':{'type': '日期时间',},}}作品 = {'cache_control': 'max-age=10,must-revalidate','cache_expires': 10,架构":{'标题': {'类型':'字符串','必需':是的,},'描述': {'类型':'字符串',},'所有者': {'type': 'objectid','必需':是的,'数据关系':{'资源':'人',可嵌入":真},},}}域 = {'人':人,'作品':作品,}
/var/www/FlaskApps/FlaskApps.wsgi
#!/usr/bin/python导入系统导入日志logging.basicConfig(stream=sys.stderr)sys.path.insert(0,"/var/www/FlaskApps/PlagiarismDefenderApp/")# home指向home.py文件从家庭导入应用程序作为应用程序application.secret_key = "somesecretsessionkey"
检查 Eve 应用正在使用的 settings
路径.检查它是否与您的 settings.py
匹配.如果您将应用指向错误的 settings.py 路径,则可能会引发此错误.
另外,我猜这是一个错字,但你写的是 settins.py
.如果这是正确的,那就是你的问题.您需要在与应用程序相同的文件夹中有一个 settings.py
,或者您需要将 settings
路径传递给应用程序.
请参阅 Eve 文档 此处 以获取有关配置的详细说明文件.
[Sat Apr 09 18:27:29.953008 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] mod_wsgi (pid=3230): Target WSGI script '/var/www/FlaskApps/FlaskApps.wsgi' cannot be loaded as Python module.
[Sat Apr 09 18:27:29.953045 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] mod_wsgi (pid=3230): Exception occurred processing WSGI script '/var/www/FlaskApps/FlaskApps.wsgi'.
[Sat Apr 09 18:27:29.953065 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] Traceback (most recent call last):
[Sat Apr 09 18:27:29.953079 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] File "/var/www/FlaskApps/FlaskApps.wsgi", line 8, in
[Sat Apr 09 18:27:29.953126 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] from run import app as application
[Sat Apr 09 18:27:29.953136 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] File "/var/www/FlaskApps/PlagiarismDefenderApp/run.py", line 28, in
[Sat Apr 09 18:27:29.953165 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] app = Eve()
[Sat Apr 09 18:27:29.953173 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] File "/usr/local/lib/python2.7/dist-packages/eve/flaskapp.py", line 139, in init
[Sat Apr 09 18:27:29.953371 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] self.validate_domain_struct()
[Sat Apr 09 18:27:29.953382 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] File "/usr/local/lib/python2.7/dist-packages/eve/flaskapp.py", line 252, in validate_domain_struct
[Sat Apr 09 18:27:29.953395 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] raise ConfigException('DOMAIN dictionary missing or wrong.')
[Sat Apr 09 18:27:29.953408 2016] [:error] [pid 3230:tid 140635784853248] [client 103.14.196.22:53950] ConfigException: DOMAIN dictionary missing or wrong.
home.py file
# -*- coding: utf-8 -*-
import os
from eve import Eve
if 'PORT' in os.environ:
port = int(os.environ.get('PORT'))
host = '0.0.0.0'
else:
port = 5000
host = '127.0.0.1'
app = Eve()
if __name__ == '__main__':
app.run(host=host, port=port)
settins.py file
import os
MONGO_HOST = os.environ.get('MONGO_HOST', 'localhost')
MONGO_PORT = os.environ.get('MONGO_PORT', 27017)
MONGO_USERNAME = os.environ.get('MONGO_USERNAME', 'user')
MONGO_PASSWORD = os.environ.get('MONGO_PASSWORD', 'user')
MONGO_DBNAME = os.environ.get('MONGO_DBNAME', 'evedemo')
RESOURCE_METHODS = ['GET', 'POST', 'DELETE']
ITEM_METHODS = ['GET', 'PATCH', 'DELETE']
CACHE_CONTROL = 'max-age=20'
CACHE_EXPIRES = 20
people = {
# 'title' tag used in item links.
'item_title': 'person',
'additional_lookup': {
'url': 'regex("[\w]+")',
'field': 'lastname'
},
'schema': {
'firstname': {
'type': 'string',
'minlength': 1,
'maxlength': 10,
},
'lastname': {
'type': 'string',
'minlength': 1,
'maxlength': 15,
'required': True,
},
'role': {
'type': 'list',
'allowed': ["author", "contributor", "copy"],
},
# An embedded 'strongly-typed' dictionary.
'location': {
'type': 'dict',
'schema': {
'address': {'type': 'string'},
'city': {'type': 'string'}
},
},
'born': {
'type': 'datetime',
},
}
}
works = {
'cache_control': 'max-age=10,must-revalidate',
'cache_expires': 10,
'schema': {
'title': {
'type': 'string',
'required': True,
},
'description': {
'type': 'string',
},
'owner': {
'type': 'objectid',
'required': True,
'data_relation': {
'resource': 'people',
'embeddable': True
},
},
}
}
DOMAIN = {
'people': people,
'works': works,
}
/var/www/FlaskApps/FlaskApps.wsgi
#! /usr/bin/python
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/FlaskApps/PlagiarismDefenderApp/")
# home points to the home.py file
from home import app as application
application.secret_key = "somesecretsessionkey"
Check the settings
path that the Eve app is using. Check if it matches your settings.py
. This error can be raised if you point the app to a wrong settings.py path.
Also, I guess it's a typo but you wrote settins.py
. If that is correct, there's your problem. You need to have a settings.py
on the same folder as the application, or you need to pass the settings
path to the app.
See the Eve docs here for a detailed explanation of configuration with files.
这篇关于eve 应用程序部署错误谁能帮我修复它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!