한국어 버전은 Django MS Azure에 Fabric으로 배포하기에서 보실 수 있습니다.
This guide covers about deploying DjangoGirls Tutorial to MS Azure Virtual machine(Ubuntu 16.04 LTS) with Fabric3.
You’re probably participant in DjangoGirls Tutorial Workshop and you’ll be now on ‘deploy’ step on it.
Today we’re going to deploy our django project to Azure which is provided with MS.
If you didnt’ register your
AzurePass yet, please precede this guide first: Register Azure and redeem AzurePass
You can’t use linux commands like
ssh on your
cmd, so we’re going to use great shell program which named
First, click this link:cmder.zip to download cmder. (It may take times.)
Second, unzip downloaded
cmder.zip file. (It’ll take some times too.) And then you got this!:
cmder.exe in this folder. If you execute
cmder.exe as a first time you’ll be see Security Warning like this: just click
And one time more, if you execute cmder for the first time, there will be another warning like this: click first option, “Unblock and continue”.
It’ll take some times when you run cmder first time. This wouln’t appear next time, so please wait for a moment!
If you see this, you’re ready to use
If you’re following DjangoGirls Tutorial, you probably made folder named
djangogirls. Let’s get into it.
cdis command to ender the folder! Let’s get into
Let’s start deploy then.
You’ll see this screen if you logged in to Azure Portal.
Let’s make Virtual machine with clicking
VirtualComputer(가상 컴퓨터) button.
Now let’s add Virtual machine with ‘+Add’ button.
If you click
+ Add button, you’ll see another options which provides many OS. But we’re going to use
Ubuntu Server today.
If you clicked Ubuntu Server there’ll be server lists like this: we’ll use
Ubuntu Server 16.04 LTS.
Then you’ll see
Create button. Click it!
You’ll see configure window when you click
Create button. Fillout blanks like picture lower.
Username should be
django(surelly this is not critical but you may encounter issues.
You may set your password on your own, but it shoud be longer/equal than 12. Please remember not to reset it later.
Select locaiton on Korea Centeral or SouthEast Asia(which available one).
Now we have to choose server size. We’ll setup just one django server so we’ll choose
DS1_V2, the left one.
Don’t worry, you won’t be charged :)
Next step you have to setup storage settings. Just select
Use managed disks to ‘Yes’.
And then click
Network Security Group(Firewall) settings. After click on it, you’ll see pre-configured setting
SSH (TCP/22). We’re going to add
+ Inbound Rule add Button, and fillout blanks like this and click OK button.
Now default settings are finished! Just click OK button.
And one more time, click confirm button.
And lastly, click confirm button more! I know you’re tired with confirm button, but this is process of Azure :)
If you see your azure dashboard again like this, your server deployment is finished :)
Please wait until your server is successfully installed! (This will take upto 5mins.)
Your browser will redirected to your server info page when your server is successfully installed.
You can access to your server info with clicking server icon-which tells
On this page you can see your server’s ‘Public IP Address’.
ip is set of numbers which provides your computer access to internet. We can upload and deploy our django project through this ip.
You can see this example server’s ip,
188.8.131.52. Surelly we can access to our server with this numbers but we can’t remember easily with it.
So we’re going to use
djangogirls.com to that
First of all, copy(CTRL+C) your virtual machine’s ip!
You may know about popular domains like
.net. But they are paid one(10 dollars per year) so we’re going to use free domain.
Let’s go to Dot.tk.
This Dot.tk provides
.tk domains as free! I’ll check
djangogirls-seoul-tutorial-en.tk as example. You should think of your own domain name and click
Oh, it’s available! Just click ‘get it now’ button and add to cart.
You’ll see this page when you clicked ‘checkout’ button. Just click ‘Use DNS’ button and input ip address of your virtual machine(azure) and click ‘Continue’.
If you forgot ip address of your virtual machine, go to Azure portal and check your machine’s ip again!
You’ll see checkout page and you have to login. You can login with your social media account like Google or Facebook!
Sometimes there are some errors(404 or others..) then you can restart from “Get free domain and connect to Virtual Machine” on this guide.
If you successfully logined, you’ll see form to input your info, but you don’t have to fill it all. Just click Agress Terms and conditions and Conitnue button, your order will be finished!
Great! You’ve just connect your own domain to your server!
Now your server is connected with
yourdomainname.tk domain. But if you try to access to that address, you can see nothing at all.
Because your server doesn’t have any django code and ofcourse, even django!
We’ll upload and deploy our django project with just one command line through
fabric3 on our computer. You can install
fabric3 with this command:
pip install fabric3
fabric3! Don’t forget 3.
fabricis python2 project.
Download Fabfile for Django and unzip it.
You can see
fabfile.py inside of it. Move 2 files into your django folder(where
deploy.json, we can edit our server(virtual machine) info.
REMOTE_HOST. Other values are already setup for djangogirls tutorial we followed.
Every values must be in “”!
We can use fabric through
fab command. Like this:
fab create_superuser. This commands will execute commands on remote server(azure virtual machine which we made)
When you use fabric for new server, just type this command and execute:
fab new_server. this will install python3, apache2, and mod_wsgi to run django.
When you edit django code and committed & pushed to github, then use
fab deploy command. This will fetch latest code on github and migrate db.
When you want to create superuser, just execute
fab create_superuser and there’ll be creating superuser prompt.
You’ve just upload and deploy REAL working web service on Azure! Congratulation!