我一直在尝试使金字塔在Google App Engine中运行,但没有解决。我尝试按照此处的说明进行操作,但由于gae不再具有appcfg.py,它似乎已过时。我遵循了App Engine文档上的flask应用程序教程,并将其与上面的应用程序结合起来以获取此信息:app.yaml
runtime: python
env: flex
runtime_config:
python_version: 3
threadsafe: false
handlers:
- url: /static
static_dir: contractors/static
- url: /.*
script: auto
Run Code Online (Sandbox Code Playgroud)
然后main.py:
from pyramid.paster import get_app, setup_logging
ini_path = 'production.ini'
setup_logging(ini_path)
app = get_app(ini_path, 'main')
Run Code Online (Sandbox Code Playgroud)
在appengine Shell控制台中,我克隆了项目存储库,将所有内容安装在virtualenv中,然后尝试运行,python main.py
但是返回未找到我的项目的发行版。easy_install paste
然后,我使用了分发错误,但python main.py
仍然无法运行。救命!
实际上,这令人沮丧。我一直想知道为什么在flask和django都在的时候,aws,gcloud和天蓝色的云没有包含金字塔教程。社区也没有这些云服务的有效教程。作为一个新手,我认为金字塔存在问题。
请问我缺少什么。当我想提供已下载到磁盘上的视频文件时,我不断在浏览器中收到内部服务器错误。这是我的代码:视图函数
@view_config(name='download_video')
def dl(request):
url = request.params.get('url')
camefrom = request.params.get('came_from')
path_dir = request.registry.settings['app.download_path']
result= save_to_disk(url, path_dir)
if result:
filename = result['filename']
filepath = os.path.abspath(os.path.join(path_dir,filename))
file_exists = os.path.exists(filepath)
if file_exists:
res = FileResponse(filepath,content_type='video/mp4')
res.headers['Content-Length'] = os.path.getsize(filepath)
res.headers['Content-Disposition'] = 'attachment;filename=%s'%filename
return res
request.session.flash(_("Error downloading video, please check your network","danger"))
return HTTPFound(location=camefrom)
Run Code Online (Sandbox Code Playgroud)
模板
<a tal:attributes="href api.url(api.root, '@@download_video', query={'came_from': request.url,'url':context.video_url})" class="btn">Download</a>
Run Code Online (Sandbox Code Playgroud)
视频下载后,我可以在文件夹中看到它,但我不断收到内部服务器错误,而浏览器上没有回溯
我的应用程序依赖于 Kotti cms