DEV Community

Cover image for Setting up your first django project.
Sebastien Ngam
Sebastien Ngam

Posted on

Setting up your first django project.

I am publishing this as a beginner too who is still on his way too mastering the full concepts of django and its functionalities as far as backend development is concerned.
this are some of the applications you will need to install.

  1. Click here to get visual studio code and install.
  2. Click here to get the latest python version and install. Now to check if python is really installed
  3. Open the installed visual studio code
  4. Open the terminal using the key combination ctrl + ~ and type
python --version
Enter fullscreen mode Exit fullscreen mode

Image description

now check the pip version you have installed

pip --version
Enter fullscreen mode Exit fullscreen mode

Image description

  1. Click here to download django.

Image description

  • I will copy the second one because i am on widows OS then paste it in my terminal.

Image description

checking the installed django version

django-admin --version
Enter fullscreen mode Exit fullscreen mode

Image description

Now you have to create a virtual environment

Create a new folder.

Image description
this is my own new folder and i have named it django-startup
click on open in terminal,
Now type

code .
Enter fullscreen mode Exit fullscreen mode

make sure to have the space between space and the stop

Withe vs code installed, your folder will be opened with it.

Image description
Open up your terminal again and type

pip install pipenv
Enter fullscreen mode Exit fullscreen mode

Image description
I have it installed already
Now activate your virtual environment by typing

pipenv shell
Enter fullscreen mode Exit fullscreen mode

Image description
You now have your activated virtual environment in you named folder
now do

pipenv install django
Enter fullscreen mode Exit fullscreen mode

now check for the installed django

pip freeze
Enter fullscreen mode Exit fullscreen mode

Image description

We now create our project

django-admin startproject simpleproject
Enter fullscreen mode Exit fullscreen mode

django-admin startproject project name

Image description
You should have this.
Now on you terminal change the directory to your project(project name)
I will type

cd simpleproject
Enter fullscreen mode Exit fullscreen mode

cd project name

Now we create and application using the command

python manage.py startapp simpleapp
Enter fullscreen mode Exit fullscreen mode

python manage.py startapp application name

now we run our server

python manage.py runserver
Enter fullscreen mode Exit fullscreen mode

Image description
Now we have http://127.0.0.1 as our local host and running on port 8000
Hold down ctrl and the click on http://127.0.0.1:8000/

Now we check it out at our running web browser

Image description
We now have our django welcome page showing that we have done a great job.

Thank you for checking out my block and i hope it helped you out one way or another.

Top comments (0)