DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 970,177 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Addd12
Addd12

Posted on

Getting started with Django project

Short introduction (you can skip this part)

Hello everyone! I am a software developer graduated recently and working in some personal projects. During the development process I've come across multiple issues and I decided to start writing on this platform for a couple of reasons:

  • helping other fellow developers by giving a set of steps I've follow in order to develop different software projects
  • I see this platform as a good way to 'save notes' and reinforce my knowledge by trying to explain it to others
  • improve my writing skills
  • make new connections I hope you find this content helpful!

Setting up a new Django project

For my projects development I use the following:

  • Visual Studio Code (VS Code), an easy-to-use IDE. Download from here
  • The latest version of Python: download from here
  • The latest version of Django which can be installed using pip package manager (described below)

Create a new folder for your Django project and open VS Code. You can drag your work folder and drop it on the 'Explorer' section on the left side of VS Code and then click 'Add folder to workspace' from the dialog box that appears. This will add a new workspace and your folder will always appear on the Explorer section unless you remove it.
From the menu bar on top of VS Code click Terminal - New terminal (if you have multiple work spaces, you'll have to choose the one you want to work with) or use the shortcut Ctrl + Shift + `. The terminal appears on the bottom but I prefer to keep it on the right side by right-clicking on top of "Terminal" and choosing 'Move to the right".
Create a virtual environment (venv) using the following command: python -m venv envName
Then activate your venv: envName\Scripts\activate.bat (the path should be in the same folder as the env)
Install Django: pip install django
Create your Django project: django-admin startproject myProject . (note the dot at the end, it will make sure not to create an additional folder called 'myProject' inside your existing folder)
Now you have your first Django project and you can run it using this command: python manage.py runserver
A link will appear on the terminal and you can open it by copying and pasting it on your favorite browser or pressing Ctrl button and the link.

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Just kidding, it's a personal preference. But you can change your theme, font, etc. in your settings.

The more you know. 🌈