DEV Community

Cover image for A simple API using Django,Postgresql and Celery
Manish Yadav
Manish Yadav

Posted on

A simple API using Django,Postgresql and Celery

Day 1
A Django rest framework API for Air pollution data of India. Air pollution data resource is from Govt. Of India Open Data Source.

A simple django project with some models and restfull api support. I am using Celery(A python lib.) to fetch data using celery tasks scheduler. I will store all data to Postgresql database.

All code will be available on Github. I will create a link in my next post.

For now i will simply start with project installations.

I am using windows system for this project. We need to install Python latest version from Download Python. After Installing Python successfully, we will install virtualenv library, virtualenv is a tool to create isolated Python environments. virtualenv creates a folder which contains all the necessary executable to use the packages that a Python project would need. It can be used standalone, in place of Pipenv. Install virtualenv via pip, since i am using windows system, so every command will run inside command prompt:

pip install virtualenv

After installing virtualenv we will create a virtual environment by using:

mkdir test_django to create a dir for project(Choose any name.)
cd test_django
virtualenv env_name to create a virtualenv.

After creating virtualenv, check that environment is activated.

(env_name)C:\test_django>

For deactivating environment use deactivate command and for re activate:

cd test_django
Scripts\activate and hit enter

First we need to install Django, which we will do by using Pyhton Pip. I am using Django version 2.2 and Django Rest Framework, you can use any latest version.

(env_name)C:\test_django> pip install django==2.2
(env_name)C:\test_django> pip install djangorestframework

We are almost set to start the project. I will create another post to start project.

Please let me know if anyone is facing any issue, i will keep updating post here.

Thanks and hope you enjoy the article.

Cheers!!!

Top comments (2)

Collapse
 
achalpathak profile image
Achal Pathak

django v3 is out...any specific reason for not using it in ur projectπŸ€”

Collapse
 
devmanish1290 profile image
Manish Yadav

Yes Django Version 3 is out, we can use latest version of Django too. But i generally prefer stable release version for Django which is 2.2. But you can use any version its up to you. And thank you for your precious time.