To get started with Django you have first to install Django. After installing Django you have to create your first app.
In this article, we’ll look at how you can install Django and most importantly, how to create your own Django app or project.
What’s Django?
Django is a powerful, open-source, and very popular web development framework written in Python programming language. It follows MVT (Model View Template) architecture.
You can create a Django project with just one command!
How To Create Django Project?
Assuming that you have already installed Django, now to create a Django project, follow the steps below:
Create a New Project
Create a new directory with your desired name and open a terminal in that directory and enter the following command:
django-admin startproject myProject
Our project is referred to here as myProject, but you can give it whatever name you like.
**Remember: Don’t give a name similar to an existing Python module like Flask, os, math, time, etc**
![[Solved] How To Create Django Project? 2 Image with command for creating a new django project](https://techtrim.tech/wp-content/uploads/2022/06/Command-for-creating-project-in-django-edited.png)
Hooray! It has successfully created your new Django project.
Managing Your New Project
Now to see your newly created project folder enter ls in the terminal. It will show all the files in the current folder including the new Django project folder that in our case is myProject.
ls
![[Solved] How To Create Django Project? 3 listing all files in current folder how to create django project edited](https://techtrim.tech/wp-content/uploads/2022/06/listing-all-files-in-current-folder-how-to-create-django-project-edited.png)
After this you have to go into your myProject folder and use the following command:
cd myProject
![[Solved] How To Create Django Project? 4 Image showing the command for going to the project directory](https://techtrim.tech/wp-content/uploads/2022/06/go-to-the-project-folder-edited.png)
Now if you want to see the files autogenerated by Django you can use the ls command:
ls
![[Solved] How To Create Django Project? 5 Image showing command for going to your main project folder](https://techtrim.tech/wp-content/uploads/2022/06/Command-to-see-autogenerated-files-by-django-edited.png)
Here you see that there’s a file named manage.py. This file is used for executing many Django-specific tasks like starting the server, making migrations, etc.
To get your first project running, enter the command below:
python manage.py runserver
If you’re using Python 3 and getting an error like
File “manage.py”, line 17 ) from exc ^SyntaxError: invalid syntax, then run this command:
python3 manage.py runserver
This command will make your project live on the URL http://127.0.0.1:8000. Enter this URL in your browser and you will see a page like this
![[Solved] How To Create Django Project? 6 Image showing default django page after creating new project](https://techtrim.tech/wp-content/uploads/2022/06/Django-new-project-default-page-edited.png)
Congratulations!
You can now easily make changes to your new Django site if you know how to use Django.
How To Install Django?
Setting up a framework or a language is very important and the very first step for development. Django is pretty easy to set up than any other framework because of the pip package manager in Python.
Install Django
To install and set up Django first of all you’ll need to install Python on your system. On Linux, you can easily install Python by running this command.
sudo apt install python3
On Windows, you can download and install Python from this link https://python.org/downloads/.
After installing Python and pip you can install Django by running this command.
pip install Django
Is Django Hard To Learn?
As Django is written in Python, Python is a very easy-to-learn and use programming language. But Django is a little bit hard to learn as compared to PHP.
If you know some basic concepts of Python programming language then it’ll be very easy for you to learn Django or even any other framework of Python like Flask, etc.
Pros of Django
- Very well-designed Web framework.
- Fast
- Very secure
- Easy to extend
- Good for deployment
Stats of Django
Django is a very popular language, that’s why many big companies use it. Following are some of the interesting stats about Django:
- 64.6K stars and 27.3K forks on GitHub.
- Over 85,000 websites use Django.
- On StackOverFlow 292K questions are asked.
Companies Using Django
Django is a very powerful and popular web development framework. It’s a very scalable, versatile, and secure framework. That’s the reason many big companies use Django.
Some of the famous companies using Django:
- Bitbucket
- Disqus
- Dropbox
- Mozilla
- Spotify
Conclusion
In this article we have discussed about