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