ENHANCE YOUR DJANGO KNOWLEDGE

 



    Start a New Project:

Description: This is like setting up a new folder e.g for your school website. It gives you all the tools and files needed to start building.

Command: django-admin startproject ideas_school

How: This command creates a folder called "ideas_school" with basic setup files.

2.       Create a New App:

Description: Inside your project, you make different sections or “apps” like “students” to handle different parts of the website.

Command: python manage.py startapp students

How: This command creates a new folder named "students" where you will add details about students.

3.       Make a Model:

Description: You define what information you want to keep about students, like their names and grades. This helps in organizing data.

Command: Write code in models.py inside the "students" folder.

How: You write instructions on what data to store, which Django uses to create database tables.

4.       Prepare the Box:

Description: You set up the database to store the student information according to your models.

Command: python manage.py makemigrations and python manage.py migrate

How: These commands create and apply database changes based on your models.

5.       Write Views:

Description: You decide what information to show on the website. For example, showing a list of students or details of a specific student.

Command: Write code in views.py inside the "students" folder.

How: You create functions that fetch data and send it to the web pages.

 

6.       Set Up URLs:

Description: You create easy names (like “students”) for pages so users can find them on your website.

Command: Write code in urls.py inside the "students" and the main "ideas_school" folder.

How: You map these names to the views you created, so the website knows what to show.

7.       Make Templates:

Description: You design how the web pages will look. This is like drawing the layout of your student pages.

Command: Create HTML files in the templates folder inside the "students" folder.

How: You create files that define the appearance of your student pages, like adding headings and pictures.

8.       Create Forms:

Description: You make forms for adding or updating student information. This allows users to submit data easily.

Command: Write code in forms.py inside the "students" folder.

How: You define how the forms should look and what data they should collect.

9.       Admin Interface:

Description: You set up an easy-to-use control panel for managing student data. This is useful for teachers or administrators.

Command: Write code in admin.py inside the "students" folder.

How: You add configurations so that you can manage student information from a web-based admin panel.

10.   Write Tests:

Description: You check if everything is working correctly. This helps ensure that the student information is managed properly.

Command: Write code in tests.py inside the "students" folder and run python manage.py test.

How: You write tests and run them to verify that the website functions as expected.

 

11.   Run the Server:

Description: You start your local website to see how it looks and works on your computer.

Command: python manage.py runserver

How: This command launches the website locally, so you can view it in your web browser.

Show to Everyone:

Description: You make the website available on the internet so everyone can access it.

Command: (Optional) Configure settings and deploy to a live server.

How: You set up and upload your website to a web server so that it’s publicly accessible.

Post a Comment

Previous Post Next Post

Contact Form