Featured image of post Set Up Django Project for School Management

Set Up Django Project for School Management

Today I started new tutorial series about django rest framework and TDD on Django, it is a best practice tutorial based on true story on development experience with django and django rest frawework.

Prerequisite for this tutorial

for better experience to follow this course make sure have already know about

  • Python Fundamental
  • Object Oriented Programming with Python
  • Familiar with Command Line (Git Bash or Terminal)

Okay, let’s start with theese index of table content

Table of Contents

  • Creating Virtual Environtment
  • Installing Django
  • Create Django Project
  • Creating New Repo to Github
  • Adding python .gitignore to django project
  • Push The Project to Repository on Github

Creating Virtual Environtment

for each Django project you start, you will first create a Virtual Environment for it. It’s like having a sandbox for each Django project. So you can play around, install packages, uninstall packages without breaking anything.

to create virtual environtment you need a python 3 to create virtual environtment

Python 3.9.6

here is a my python version, so let’s started to create virtual environtment

python -m venv venv

and virtual environtment is currently created

Activate Virtual Environtment

to activate can using source if use linux or mac

source venv/bin/activate

if you use windows


Installing Django

next step is installing django, refer to docs you can install with pip

pip install Django

Creating Django Project

To Start new Django project, run the command below, in this case we create django project named core and renamed to backend

django-admin startproject core

and then rename to backend

mv core backend

django project structure
django project structure

Creating New Repository on Github

to continue make sure you have created a github account, at this stage we will create a repository on github to store code online so that it can be accessed from anywhere

to create repo, klick new on top right github page and give name for your repo, for example

creating new repo to upload code on git
creating new repo to upload code on git

if you create repo you will see the command line on your repo

command to push in github
command to push in github

Adding Python gitignore

in the previous step we have not added python .gitignore which will be used to determine which files will be uploaded to github

get new python gitignore here

and create python gitignore to project root folder

Push Project To github

to push project we need to initialize project with empty git repository

git init --initial-branch=main

and then copy remote address on github page where you create new repositories on previeus step, on my case

git remote add origin

and then add to git

git add .

next step is commit

git commit --message="First Commit"

last is push to github

git push origin main

and refresh your browser

the project is already pushed on github
the project is already pushed on github

Licensed under CC BY-NC-SA 4.0
Last updated on Apr 03, 2022 14:59 +0700
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy