virtualenv:无法访问lib:没有此类virtualenv或站点目录 [英] virtualenv: cannot access lib: No such virtualenv or site directory

查看:88
本文介绍了virtualenv:无法访问lib:没有此类virtualenv或站点目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google Cloud Platform创建一个基于Django的http API,它使用了Google的云SQL API和机器学习API。

I am using Google Cloud Platform to create a Django based http API, which uses Google's cloud SQL API and Machine Learning API.

我制作了一个django-mysql应用程序在我的电脑上,并能够在本地主机上成功测试它。我想将此应用程序部署到Google Cloud。

I made a django-mysql app on my pc and is able to test it successfully on localhost. I want to deploy this app to Google Cloud.

以下是我的相关文件:
app.yaml:-

Following are my relevant files: app.yaml:-

runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: /static
  static_dir: static/
- url: .*
  script: mysite.wsgi.application

libraries:
- name: MySQLdb
  version: 1.2.5
- name: numpy
  version: "1.6.1"


skip_files:
- ^(.*/)?- ^(.*/)?.*~$
- ^(.*/)?.*\.py[co]$
- ^(.*/)?.*/RCS/.*$
- ^(.*/)?\..*$
- ^env/.*$

appengine_config.py:-

from google.appengine.ext import vendor
import os
vendor.add(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib'))

我在api home上遇到500错误。 此处。我在仪表板上收到以下错误报告:-

I am getting a 500 error on api home. here. I am getting the following error report on my dashboard:-

Traceback (most recent call last):
  File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/1/google/appengine/api/lib_config.py", line 351, in __getattr__
    self._update_configs()
  File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/1/google/appengine/api/lib_config.py", line 287, in _update_configs
    self._registry.initialize()
  File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/1/google/appengine/api/lib_config.py", line 160, in initialize
    import_func(self._modname)
  File "/base/data/home/apps/b~neuralnet-171308/20170628t204601.402294282540056750/appengine_config.py", line 18, in <module>
    vendor.add('lib')
  File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/1/google/appengine/ext/vendor/__init__.py", line 44, in add
    'No such virtualenv or site directory' % path)
ValueError: virtualenv: cannot access lib: No such virtualenv or site directory

最初 appengine_config.py 包含:-

from google.appengine.ext import vendor

vendor.add('lib')

根据建议 ,我将其更改为当前文件。

As suggested here, I changed it to the current file.

我使用 gcloud app deploy 部署我的项目。我不明白如何使用 gcloud_sql_proxy 进行部署。

I deploy my project using gcloud app deploy. I do not understand how to use gcloud_sql_proxy for deploying.

我肯定有 lib 文件夹与 app.yaml 位于同一目录中。我不知道我在做什么错。

I am for sure having a lib folder in same directory as app.yaml. I do not know what I am doing wrong. Any help or suggestion is appreciated.

推荐答案

此处似乎是正确的。并如该示例所示 app ,尝试使用pip安装依赖项:

The prior configuration as mentioned here seems to be correct. And as shown in this sample app, try installing dependencies with pip:

pip install -t lib -r requirements.txt

这篇关于virtualenv:无法访问lib:没有此类virtualenv或站点目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆