Create own Blog app in Django [Tutorial]
Tags: tutorial, django, python, programming
Published: 2021-04-12 15:57:00

## Blog Features
* CKEditor in Admin
* Threaded Comment system
* Tagging functionality
* Retrieving similar posts
* Search functionality
* Auto Sitemap

So Let's start

## Virtual Environment Setup

Virtualenv is a tool used to create an isolated Python environment. This environment has its own installation directories that doesn’t share libraries with other virtualenv environments (and optionally doesn’t access the globally installed libraries either).

**Installation**

to install virtual environment just type following command in the terminal.

```
pip3 install virtualenv
```
Before making a virtual environment we make project directory. Inside it, we make a virtual environment. Type following command in terminal.

```
mkdir awwblog
```
Inside awwblog directory we setup virtual environment. Type following command in terminal.

```
cd awwblog/
```
First find your python installation path of particular version,

```
which python3.9
```
I use python3.9 here. By above command you get the path of the python3.9 (of any version)

I want python3.9 in my virtual environment. So let’s create virtual environment.

Using virtualenv command we created env_awwblog virtual environment. Every python installation goes inside that. But before installing python stuff we need to activate the virtual environment.

Type following command.

```
source env_awwblog/bin/activate
```
No, we are ready to install Django inside virtual environment. So let’s go…

## Installing Django
```
pip3 install Django
```
Now Django is installed in our environment

## Creating awwblog Project
Everything going fine right. Now we start the project using django-admin command.
```
django-admin startproject awwblog
```
The command should have created a awwblog directory. Use the command cd awwblog to go into the directory.

The command should have created a awwblog directory. Use the command cd awwblog to go into the directory.

```
python3 manage.py runserver
```
Just hit the url http://127.0.0.1:8000/ in browser.
Now you can see this,

![](https://www.codesnail.com/wp-content/uploads/2021/03/image-7-1024x529.png)

If you see this in your browser, congratulation!! your Django installation is done successfully. Now we create an app.

## Creating blog App

Now let’s create your first Django application. You will create a blog application from scratch. From the project’s root directory, run the following command

```
python3 manage.py startapp blog
```
Open awwblog directory in your favorite code editor. I am using VS code. Below is the structure of how our project file structure looks like after setting up everything,

![](https://www.codesnail.com/wp-content/uploads/2021/03/image-8.png)

Now open settings.py in the awwblog directory. The first thing you need to do is to add the created app “blog” in the INSTALLED_APPS.

```python
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'blog',
]
```
This holds the Django apps you’ll be using in the Django project.

That’s it for this article. In next tutorial we will build post modal to store blog posts.

Hope you like it. Please share this tutorial with your friends.

Next: [Next: Designing the blog data schema – Django Blog #2](https://www.codesnail.com/designing-the-blog-data-schema-django-blog-2/)


<a href='https://ko-fi.com/F1F44PLC7' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://cdn.ko-fi.com/cdn/kofi1.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>