Making a website

john | May 16, 2020, 8:46 a.m.

Although I made this website/blog on Django, I don't actually remember much of the process.  Not because I have a bad memory, it's incredible if I care about the thing I'm remembering, if I don't it's as if it never happened.

So like most of my life, it happened but I have no recollection of the important parts, like birth.

Which leads me to this wonderful excuse for a place to store my forgotten memories, hopefully only the useless ones, like making a website with Django.

Why Django?

Because it has an admin panel.  I know that sounds ridiculous, but it's true.  Most the websites I make don't need admin panels, but every once in a while I have an idea that I think will need one, and well Django comes with one, that is kind of nice, so that's why Django.  And in reality Django is probably fine for most every use you need a website for.   Because by the time you run into problems that Django is having problems with, you probably are having good problems, or problems that means your website is huge and you are internet famous.

Also, the main reason you should choose Django is because you will stop procrastinating and do the one thing you need to do, which is starting to actually build the website.

Step 1, Choosing a Web Hosting provider

I would give you some very long explanation as to why you should choose any of the following providers.  But honestly, it doesn't matter, because by the time you have problems with any of them, you probably will probably be so big that you will also be having problems with governments and you will be internet famous, or on a yacht, or writing your last blog post that breaks the internet in the most passionate of ways. 

So choose either DigitalOcean, or Vultr and yes those are affiliate links, because, like you I also once started a website on those hosts and still have websites on there, so your helping me cover my hosting like I'm helping you make this website. 

Don't worry, sign up for their cheapest Ubuntu 18.04 VPS server in any region.  Plus if you can't figure out how to deploy a Ubuntu 18.04 server on either of those hosts, then you probably aren't made for Django either, but I'm sure they have other options for other CMS's, such as WordPress, that might fit your needs.  Just those wont be covered here.

Step 2, Log in and secure server

Now if you used DO you will get a email with your ip address and root password, if you used vultr it will be in your admin panel.

The first thing to do is to ssh into the server, Windows (use putty) and Mac users user Finder to search for terminal, and Ubuntu users type ctrl+alt+t

With the ssh client, open and type the following into it.

ssh root@

Of course you should use your own ip Address.

Once you log in to your server, the first thing you want to do is make another user that has `sudo privileges and disable root user login to make your server more secure.

So first we are going to do,

adduser cooluser

then once that is done, you do

adduser cooluser sudo

Ok now we have our cooluser made so now we need to disable root login and log out, so next we type

sudo passwd -l root



Step 3, Installing requirements and virtual environment

Now you should be back in your local terminal, from there we now ssh in with our new user

ssh cooluser@

Creating And Activating A Virtual Environment
When making a website with python, it’s a good practice to work in virtual environments to keep your project, and it’s dependency isolated on your machine.  There are a few reasons for this, you can google around and figure it out if you really care to know.

Next we are going to make the directory and virtual environment, you will have to enter your sudo password which you made earlier when making your cool user.

sudo mkdir /home/www && cd /home/www
sudo mkdir django
python3 -m venv env
source env/bin/activate
cd django

Once you have this activated you should see something along the lines of


Now that we have the virtualenv activated, we are going to install Django to the virtual environment by typing

pip install Django

This should install Django in your virtual environment.  From here we set up Django by typing

django-admin startproject mysite

Awesome! We now are almost there to having a skeleton website up and running!

if you type in ls you should see folders and directories that are something like this, you can use the cd command to go between them for example cd mysite will move you to mysite directory and typing ls will show you whats in there.  To go back one directory type cd ..

This is the layout of your basic website


This is the layout of your basic Django website.  Now if we type

python runserver

We should see the following output, which lets us know the website is up and running.

Performing system checks...

System check identified no issues (0 silenced).

You have unapplied migrations; your app may not work properly until they are applied.
Run 'python migrate' to apply them.

January 08, 2020 - 15:50:53
Django version 2.0, using settings 'mysite.settings'
Starting development server at
Quit the server with CONTROL-C.

This lets us know that the server is up and running on port :8000. But that it also missing its migrations haven't been applied.  We can worry about this later. 

At this point we have successfully installed and set up a basic website on a server.

You can access it now, even though it's in development by going to youripaddress:8000

At this point, my job is done here.  From here I hand you off to the very capable hands of DjangoCentral and their tutorial

It tells you how to set up the rest of the site with a SSL and git.  They also have quite a bit of information so you can go ahead and make Django what you need it to be, from anything such as a simple blog, to Pintrest.

P.S. Like what you read? Show it to your friends.

P.P.S. Subscribe to my newsletter although not sure if it works just yet and follow me on twitter

About Me

Welcome to the world of Johnathan Nader. Here you will find writings of various things. I will try to stay on topic on some, and digress in others. If you want to know more about me

Click here!