How to Create a Django Project and Application.
Tags: webdev, beginners, django, python
Published: 2023-10-20 23:29:53

### Introduction.

This article is a guide on how to create your (first) Django project and application.

#### A Little about Django.

The web framework for perfectionists with deadlines.

Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source.

***Copied from the*** [***Django official website***](https://www.djangoproject.com/)***.***

Interested in reading a little about Python, check out one of my articles [The Language: Python](https://chryzcode.hashnode.dev/the-language-python).

### Get started

#### Prerequisites and Requirements

Here are the prerequisites and requirements to get started in creating your Django application :

* Install [Python](https://www.youtube.com/results?search_query=install+python).
    
    Paste this command on your terminal. The command below is to verify if you have Python properly installed. It should provide the version of Python you installed.
    
    ```python
    python --version
    ```
    
* Install [Django](https://www.youtube.com/results?search_query=install+django).
    
    The same thing applies to Django.
    
    ```python
    django-admin --version
    ```
    

#### Create a Django Project.

I believe you have Python and Django installed. Navigate to the directory of your choice on your terminal, `desktop` is my choice of directory for my new Django project

```python
cd desktop
```

and paste the command below to create your project, `my_project` is the name of my Django project.

```python
django-admin startproject my_project
```

To check the files or folders in your project

```python
#for MacOS
ls my_project

#for Windows
dir my_project
```

#### Create a Django Application

To create your Django application copy and paste the command below on your terminal to change your directory to the newly created project.

```python
#to change directory
cd my_project

#to create a django app
django-admin startapp my_app
```

Note: It is possible to have multiple applications based on the scope of the project.

#### Run and Test the Django Project

To check if our Django project is up and running, paste this code below on your terminal. The command is to run your server(app/project) locally.

```python
python manage.py runserver
```

If the image below is the same as yours, then you have successfully created your Django project/ application.

The warning about unapplied migrations is related to the database which will not be covered.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tnjkf7hctel3woz13zah.png)


To view the locally hosted project on your browser, click this link [http://127.0.0.1:8000/](http://127.0.0.1:8000/). This is the local server link to your Django application and this should be the view of your project on the browser.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/laofu2tkgcyunucfbd70.png)

> Congratulations on creating your (first) Django application.

[**Continuation...**](https://dev.to/chryzcode/the-django-project-folder-and-files-structure-and-architecture-1-3ei9)