Django Part-2

·

2 min read

Let's now start creating a project, Go to terminal and fire up the command:

django-admin startproject mysite

This will create a folder named "mysite" and a manage.py file: Capture.PNG The manage.py file is a autogenerated file, which helps you to interact with your project using command line. The folder mysite will further contain:

Capture2.PNG

A small description about the above generated files:

- init.py : It tells the Python interpreter that your folder contains Python code and this particular directory should be considered as a Python package.

  • settings.py: It will be used for configuration purpose.

  • urls.py: For routing purposes.

  • asgi.py and wsgi.py: These files will be used to provide hooks for asgi-compatible web servers or wsgi-compatible web servers when the project is on live server.

Lets understand what it is: So, you created a project called 'mysite'. This project can contain multiple different apps. In Django you can create different applications for contact, user-profile page, posts etc..

Creating different applications for the same project can help you to manage individual functionalities without affecting any other functionality. It basically helps to maintain a good development environment. In our project we will only create one app to handle all functionalities. To create our app, go to the folder having 'manage.py' file and run the following command:

python manage.py startapp Socialize

It will create a folder named "Socialize", with the following contents:

Capture3.PNG

Do not worry if you don't understand the significance of other files yet. You will be familiar with them by the end of this series.