filmov
tv
Learn Django in 20 Minutes!!
Показать описание
#techwithtim #python #programming
⭐️ Tags ⭐️
- Tech with Tim
- Django
- Python
⭐️ Hashtags ⭐️
#techwithtim #programming#python
Django Tutorial Part 2: Creating a skeleton website
Overview
This article shows how you can create a "skeleton" website, which you can then populate with site-specific settings, paths, models, views, and templates (we discuss these in later articles).
To get started:
Note: A website may consist of one or more sections. For example, main site, blog, wiki, downloads area, etc. Django encourages you to develop these components as separate applications, which could then be re-used in different projects if desired.
Register the new applications to include them in the project.
Hook up the url/path mapper for each application.
For the Local Library website, the website and project folders are named locallibrary, and includes one application named catalog. The top-level folder structure will therefore be as follows:
locallibrary/ # Website folder
locallibrary/ # Website/project folder (created using django-admin)
The following sections discuss the process steps in detail, and show how you can test your changes. At the end of this article, we discuss other site-wide configuration you might also do at this stage.
Creating the project
To create the project:
Open a command shell (or a terminal window), and make sure you are in your virtual environment.
Navigate to the folder where you want to create your local library application (later on we'll move it to the "django_local_library" that you created as a local GitHub repository when setting up the development environment).
Create the new project using the django-admin startproject command as shown, and then navigate into the project folder:
BASH
Copy to Clipboard
django-admin startproject locallibrary
cd locallibrary
The django-admin tool creates a folder/file structure as follows:
BASH
Copy to Clipboard
locallibrary/
locallibrary/
__init__.py
The locallibrary project sub-folder is the entry point for the website:
__init__.py is an empty file that instructs Python to treat this directory as a Python package.
Creating the catalog application
BASH
Copy to Clipboard
# Linux/macOS
# Windows
Contact Us: +92 300 4870104 322 8499993
YouTube Channel: @adnanmajeed4825
⭐️ Tags ⭐️
- Tech with Tim
- Django
- Python
⭐️ Hashtags ⭐️
#techwithtim #programming#python
Django Tutorial Part 2: Creating a skeleton website
Overview
This article shows how you can create a "skeleton" website, which you can then populate with site-specific settings, paths, models, views, and templates (we discuss these in later articles).
To get started:
Note: A website may consist of one or more sections. For example, main site, blog, wiki, downloads area, etc. Django encourages you to develop these components as separate applications, which could then be re-used in different projects if desired.
Register the new applications to include them in the project.
Hook up the url/path mapper for each application.
For the Local Library website, the website and project folders are named locallibrary, and includes one application named catalog. The top-level folder structure will therefore be as follows:
locallibrary/ # Website folder
locallibrary/ # Website/project folder (created using django-admin)
The following sections discuss the process steps in detail, and show how you can test your changes. At the end of this article, we discuss other site-wide configuration you might also do at this stage.
Creating the project
To create the project:
Open a command shell (or a terminal window), and make sure you are in your virtual environment.
Navigate to the folder where you want to create your local library application (later on we'll move it to the "django_local_library" that you created as a local GitHub repository when setting up the development environment).
Create the new project using the django-admin startproject command as shown, and then navigate into the project folder:
BASH
Copy to Clipboard
django-admin startproject locallibrary
cd locallibrary
The django-admin tool creates a folder/file structure as follows:
BASH
Copy to Clipboard
locallibrary/
locallibrary/
__init__.py
The locallibrary project sub-folder is the entry point for the website:
__init__.py is an empty file that instructs Python to treat this directory as a Python package.
Creating the catalog application
BASH
Copy to Clipboard
# Linux/macOS
# Windows
Contact Us: +92 300 4870104 322 8499993
YouTube Channel: @adnanmajeed4825