4
votes

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.

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)
  3. Setup pip and virtualenv
  4. Create a virtualenv and clone my project from GitHub
  5. Install all requirements from requirements.txt
  6. now when I try to run my app as python manage.py runserver from my directory, it says :

Django version 1.10.5, using settings 'brain.settings'

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

Quit the server with CONTROL-C.

  1. when I visit http://127.0.0.1:8000/ doesn't load any page.

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

1
did you open port 8000 on GCP firewall?Thomas Schwärzl
Hi, @user! do i need to add a firewall rule with port tcp:8000 ?Abdul Rehman
yes, TCP. And for your upcoming question: You should keep in mind, that GCP doesn't allow you to send mails with port TCP:25 and you'll need an extra provider for that.Thomas Schwärzl
i have added that but still not loading!Abdul Rehman
replace 127.0.0.1 with the public IP of your GCP instanceThomas Schwärzl

1 Answers

4
votes

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

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

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

python manage.py runserver 0.0.0.0:8000