Django Hands on

Python into the web


I started with Python last month, just to see what is the fuss about it. I can see how simple it is and that makes it quite powerful, but coming from Ruby and Ruby on Rails, I can see serious resemblance between both of them, and now with Django more of the same. It’s fine, it’s not a critic, not bad feelings, it’s just an observation, if you “jump” from one to another it will not be a “cliff jumping” just a “mud puddle” kind of jump.

Here the steps to have a Django project kicking in no-time. You must have previously python 3 installed ( I followed these steps ). I did in a Windows 10 machine, so this my list of steps. Open a Powershell with Administrator rights and start typing:

# Create directory for your new project
mkdir blog
cd blog

# Create a virtual environment for your project
python -m venv ll_env
# to stop it 

# Install Django
pip install django

# Create the project in Django ATTENTION: Don't forget the . at the end!!!
django-admin startproject blog .

# Creating the database SQLite
python migrate

# Viewing the project 
python runserver

# go to

# Tada!!!!

# Create an App inside your project
# Your virtual environment must be activated
python startapp blogs

You will have to modify in under your project “Blog” to add your app, so it looks like:

..... Snip ..... 
    # My apps
    # Default django apps
..... Snip ..... 
# Let's create a superuser for our admin part
python createsuperuser 
(enter username, and password of your choice, the email is totally optional)

And now you can login in your app as superuser in the admin area :

And now it’s when you start creating models, views, templates, etc.