DEV Community

Cover image for I made a Boilerplate Script for Django Project Setup
Kritebh Lagan Bibhakar
Kritebh Lagan Bibhakar

Posted on • Edited on

I made a Boilerplate Script for Django Project Setup

Recently I started to learn to React and the best part about React is when I want to set up a new project I have 'create-react-app' which make a smoother experience in creating a project.

It installs all the required dependencies, initialized git and added some extra file also.

But there is no such tool for Django or I don't know

Whenever I have to set up a new Project in Django, I have to do some repetitive task like :

  • python -m venv env
  • pip install django
  • git init
  • touch .gitignore
  • code .

Yack...

Waste of time

So I have created a PowerShell script that will create a Virtual Environment and install Django in a folder provided by you in the current directory.

After this It will also create a .gitignore file with "/env" and finally your project will open in VS Code

Prerequisite

  • Python Installed
  • Git Installed
  • Visual Studio Code Installed

Python Download

Git Download

Visual studio Code Download

How to use this script

First of all get the script.

GitHub logo kritebh / django-boilerplate-shell-script

A simple Shell Script to create Django Project in Virtual Environment

Note : Currently, I have created only three variant of this and download the most suitable script for you.

You can modify it according to your preferences.

Like if you don't want to open Visual Studio Code after creating the project then just remove the "code ."

Similarly, if you want to run the server after creating the project then you can use third script

Let's say you want to install more module like django-rest-framework or Pillow then just add the code like this after pip install django.

...
...
pip install django
pip install djangorestframework
pip install pillow
...
...
Enter fullscreen mode Exit fullscreen mode

Put your script in the directory where you want to create a new folder and set up your Django Project.

Finally, Run the script by right-clicking on it and click on "Run with PowerShell"

Run with Powershell

Here is the screenshot of script in action :

Django Script

If you not creating a lot of project like me then it will fine for you to set up Project on your own.

But I think for those who are learning Django and creating a lot of projects then this script will help them 😊

If you have any doubt regarding this or have any suggestions you can comment below.

Thanks for reading!

Top comments (5)

Collapse
 
masterroshan profile image
TJ Johnson

More people should know about this github.com/cookiecutter/cookiecutt...

Collapse
 
lechatthecat profile image
lechat

Nice idea!

Collapse
 
kritebh profile image
Kritebh Lagan Bibhakar

Collapse
 
darrentmorgan profile image
darrentmorgan

I had this issue when I started also. I now have a pre-made Docker-compose to make the process easily portable. Nice work here though.

Collapse
 
kritebh profile image
Kritebh Lagan Bibhakar

Yes, I agree and Thank You