在Google Compute Engine上使用python 3.6部署Django 1.10应用程序

时间:2022-09-16 20:27:49

I have created a project using with Django 1.10.5 and python 3.6, now I need to deploy this project on google compute engine.I have googled a lot but couldn't find any clear guide to deploy my Django app on compute engine.

我已经创建了一个使用Django 1.10.5和python 3.6的项目,现在我需要在谷歌计算引擎上部署这个项目。我搜索了很多但是找不到任何明确的指南来在计算引擎上部署我的Django应用程序。

What I have tried:

我试过的:

  1. Create a compute engine instance
  2. 创建计算引擎实例

  3. Install python 3.6 (But not succeded that's why using pre-installed python 3.5.2)
  4. 安装python 3.6(但没有成功,这就是为什么使用预安装的python 3.5.2)

  5. Setup pip and virtualenv
  6. 设置点子和virtualenv

  7. Create a virtualenv and clone my project from GitHub
  8. 创建一个virtualenv并从GitHub克隆我的项目

  9. Install all requirements from requirements.txt
  10. 安装requirements.txt中的所有需求

  11. now when I try to run my app as python manage.py runserver from my directory, it says :
  12. 现在当我尝试从我的目录运行我的应用程序作为python manage.py runserver时,它说:

Django version 1.10.5, using settings 'brain.settings'

Django版本1.10.5,使用设置'brain.settings'

Starting development server at http://127.0.0.1:8000/

在http://127.0.0.1:8000/启动开发服务器

Quit the server with CONTROL-C.

使用CONTROL-C退出服务器。

  1. when I visit http://127.0.0.1:8000/ doesn't load any page.
  2. 当我访问http://127.0.0.1:8000/时,不加载任何页面。

How can I deploy my Django 1.10 & Python 3.6 app on google compute engine? Help me, please! Thanks in advance!

如何在谷歌计算引擎上部署我的Django 1.10和Python 3.6应用程序?请帮帮我!提前致谢!

1 个解决方案

#1


3  

All you need to do is to add a new incoming Firewall rule on Google Cloud Platform (GCP) for TCP:8000.

您需要做的就是在Google Cloud Platform(GCP)上为TCP:8000添加新的传入防火墙规则。

To do so simply connect to your GCP: Console Firewall Rules and add a new rule.

为此,只需连接到您的GCP:控制台防火墙规则并添加新规则。

Also be sure to launch Django to listen on the public interface and you to access with the public IP.

另外一定要启动Django来监听公共接口,并使用公共IP进行访问。

python manage.py runserver 0.0.0.0:8000

#1


3  

All you need to do is to add a new incoming Firewall rule on Google Cloud Platform (GCP) for TCP:8000.

您需要做的就是在Google Cloud Platform(GCP)上为TCP:8000添加新的传入防火墙规则。

To do so simply connect to your GCP: Console Firewall Rules and add a new rule.

为此,只需连接到您的GCP:控制台防火墙规则并添加新规则。

Also be sure to launch Django to listen on the public interface and you to access with the public IP.

另外一定要启动Django来监听公共接口,并使用公共IP进行访问。

python manage.py runserver 0.0.0.0:8000