简体   繁体   English

为什么在 App Engine Flexible dockerfile 中没有执行 manage.py 文件?

[英]Why the manage.py file is not executed in the App Engine Flexible dockerfile?

So the dockerfile that App Engine uses to generate a container for a Django app is as following:因此,App Engine 用于为 Django 应用程序生成容器的 dockerfile 如下所示:

FROM gcr.io/google-appengine/python@sha256:c6480acd38ca4605e0b83f5196ab6fe8a8b59a0288a7b8216c42dbc45b5de8f6

LABEL python_version=python3.7

RUN virtualenv --no-download /env -p python3.7

ENV VIRTUAL_ENV /env

ENV PATH /env/bin:$PATH

ADD requirements.txt /app/

RUN pip install -r requirements.txt

ADD . /app/

CMD exec gunicorn -b :$PORT myteam.wsgi

My question is then why don't we see the command:我的问题是为什么我们看不到命令:

python manage.py runserver

And instead we see: gunicorn -b:$PORT myteam.wsgi相反,我们看到: gunicorn -b:$PORT myteam.wsgi

Does it imply that the gunicorn command runs the server?这是否意味着gunicorn命令运行服务器?

Elaborating more from my comment, the command you expected to see ( python manage.py runserver ) is used to start the django development server .从我的评论中详细说明,您希望看到的命令( python manage.py runserver )用于启动 django 开发服务器 As shown in that documentation page:如该文档页面所示:

...lightweight web server written purely in Python. ...轻量级 web 服务器纯粹用 Python 编写。 We've included this with Django so you can develop things rapidly, without having to deal with configuring a production server – such as Apache – until you're ready for production.我们已将其包含在 Django 中,因此您可以快速开发,而无需处理配置生产服务器(例如 Apache),直到您准备好进行生产。 Now's a good time to note: don't use this server in anything resembling a production environment.现在是注意的好时机:不要在任何类似于生产环境的环境中使用此服务器。

Now, Gunicorn is what is known as a WSGI server, which is an interface for running python applications in web servers.现在,Gunicorn 就是所谓的 WSGI 服务器,它是在 web 服务器中运行 python 应用程序的接口。 It handles running your python code from server requests, and offers benefits like scaling and flexibility.它处理从服务器请求运行您的 python 代码,并提供可扩展性和灵活性等优势。 You can see a full summary here .您可以在此处查看完整摘要。

A WSGI server would be appropriate for deploying a Python application to App Engine, since it's a production environment ready to serve any number of users. WSGI 服务器适合将 Python 应用程序部署到 App Engine,因为它是一个可以为任意数量的用户提供服务的生产环境。

The specific command ran to start the container CMD exec gunicorn -b:$PORT myteam.wsgi will search for the wsgi.py module included with Django projects (in this case, the myTeam project).运行特定命令以启动容器CMD exec gunicorn -b:$PORT myteam.wsgi将搜索 Django 项目(在本例中为myTeam项目)中包含的wsgi.py模块。 The .py extension is omitted. .py扩展名被省略。 You can see a more detailed explanation here .您可以在此处查看更详细的说明。 Let me know if this was useful.让我知道这是否有用。

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

相关问题 App Engine 灵活环境 - Dockerfile 安装过时版本的 GDAL - App Engine Flexible Environment - Dockerfile installing outdated version of GDAL App Engine Flexible - Docker 文件无法安装 GDAL - App Engine Flexible - Docker file fails to install GDAL 将 App Engine flexible 降级到 App Engine 标准环境 - Downgrade App engine flexible to app engine standard environment 如何在 Google App Engine 柔性环境中设置 jetty 线程池 - how to set the jetty thread pool in Google App Engine flexible environment App Engine Flex 自定义 - Dockerfile 构建过程中缺少项目文件 - App Engine Flex custom - missing project files in Dockerfile build process Numpy 在 Python3 Google App Flexible Engine 中失败 - Numpy failing in Python3 Google App Flexible Engine 调用 App Engine 柔性环境 API 时如何停止混合内容浏览器错误? - How to stop mixed Content browser Error when calling App Engine Flexible Environment API? Google App Engine 如何从灵活环境转变为标准环境 - How do change from Google App Engine from Flexible Environment to Standard environment 为 Google App Engine 转换 pfx 文件 - Converting pfx file for Google App Engine APP Engine Google Cloud Storage - 下载文件时出现错误 500 - APP Engine Google Cloud Storage - Error 500 when downloading a file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM