简体   繁体   English

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

[英]Deploy Django 1.10 app with python 3.6 on Google Compute Engine

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的项目,现在我需要在谷歌计算引擎上部署这个项目。我已经google了很多但是找不到任何明确的指南来在计算引擎上部署我的Django应用程序。

What I have tried: 我尝试过的:

  1. Create a compute engine instance 创建计算引擎实例
  2. Install python 3.6 (But not succeded that's why using pre-installed python 3.5.2) 安装python 3.6(但没有成功,这就是为什么使用预安装的python 3.5.2)
  3. Setup pip and virtualenv 设置pip和virtualenv
  4. Create a virtualenv and clone my project from GitHub 创建一个virtualenv并从GitHub克隆我的项目
  5. Install all requirements from requirements.txt 安装requirements.txt中的所有需求
  6. now when I try to run my app as python manage.py runserver from my directory, it says : 现在,当我尝试从我的目录运行我的应用程序作为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. 当我访问http://127.0.0.1:8000/没有加载任何页面。

How can I deploy my Django 1.10 & Python 3.6 app on google compute engine? 如何在谷歌计算引擎上部署我的Django 1.10和Python 3.6应用程序? Help me, please! 请帮帮我! Thanks in advance! 提前致谢!

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

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM