[CRUD] [Django] Create a CRUD site using the Python framework Django ~ 1 ~

What is CRUD?

It refers to the Create (register), Read (reference), Update (update), and Delete (delete) functions. We will implement these functions in Dango.

Do you make an app

I would like to create a blog site. I'm thinking about blueprints, but the main functions are listed below.

*** Blog function ***

--Post Article (Create) --See article (Read) --Article Update (Update) --Delete article

*** User management function ***

--User login --User logout

Create a development environment

In this development, we will use a virtual environment. In a virtual environment, if you refer to PipFile, the version of each package is organized, so I think that it is easy to share the development environment in multi-person development.

Pipfile


[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
flake8 = "*"
autopep8 = "*"

[packages]
django = "==3.1.1"

[requires]
python_version = "3.8"

By the way, you can build the same environment as me with the following command.

pip install pipenv 

pipenv shell

pipenv install django==3.1.1

pipenv install --dev flake8 autopep8

Create a project

The project name can be anything, but the folder created by this command is config because it is the folder where the configuration files of the entire project are stored.

django-admin startproject config .

Create an application

In Django, we will create apps (functions) in the project. First, we will create a blog function, so let's call it blog.

python manage.py startapp blog

After creating the app, you have to set the project as "App created!". Add the following to /crud/config/settings.py. In addition, let's set the language and time zone.

/crud/config/settings.py


INSTALLED_APPS = [
    'blog.apps.BlogConfig',
    ***
]

LANGUAGE_CODE = 'ja'

TIME_ZONE = 'Asia/Tokyo'

That's all for today. Do you have the following directory files? image.png

Thank you very much.

Recommended Posts

[CRUD] [Django] Create a CRUD site using the Python framework Django ~ 1 ~
[CRUD] [Django] Create a CRUD site using the Python framework Django ~ 2 ~
[CRUD] [Django] Create a CRUD site using the Python framework Django ~ 3 ~
[CRUD] [Django] Create a CRUD site using the Python framework Django ~ 4 ~
[CRUD] [Django] Create a CRUD site using the Python framework Django ~ 5 ~
Create a Todo app with the Django REST framework
Create a Python general-purpose decorator framework
Install Python framework django using pip
Create a CRUD API using FastAPI
Try using the Python web framework Django (2) --Look at setting.py
Implementation of CRUD using REST API with Python + Django Rest framework + igGrid
Create a graph using the Sympy module
[Python] Create a Batch environment using AWS-CDK
[Ev3dev] Create a program that captures the LCD (screen) using python
Create a REST API to operate dynamodb with the Django REST Framework
Create a shogi game record management app using Django 3 ~ Django default management site settings ~
Try using the Python web framework Django (1)-From installation to server startup
Create a record with attachments in KINTONE using the Python requests module
Create a GIF file using Pillow in Python
Try using the Python web framework Tornado Part 1
Create a web map using Python and GDAL
Run a Python file from html using Django
Create a Mac app using py2app and Python3! !!
Try using the Python web framework Tornado Part 2
Create a MIDI file in Python using pretty_midi
Create a GUI on the terminal using curses
Create a Django schedule
Django python web framework
Create a Python module
Create a Python environment
Create a Python image in Django without a dummy image file and test the image upload
Create a simple reception system with the Python serverless framework Chalice and Twilio
Create a Django project and application in a Python virtual environment and start the server
Try to create a Todo management site using WebSocket with Django (Swamp Dragon)
Create a data collection bot in Python using Selenium
Create a Todo app with Django REST Framework + Angular
Cut a part of the string using a Python slice
(Python) Try to develop a web application using Django
[Python] Create a ValueObject with a complete constructor using dataclasses
DJango Note: From the beginning (using a generic view)
Build a Python virtual environment using venv (Django + MySQL ①)
[Django Rest Framework] Customize the filter function using Django-Filter
[Python] Mask the image into a circle using Pillow
Create a company name extractor with python using JCLdic
A little bit from Python using the Jenkins API
Create a dictionary by searching the table using sqlalchemy
[Python] Let's change the URL of the Django administrator site
Create a Wox plugin (Python)
Create a function in Python
[S3] CRUD with S3 using Python [Python]
Create ToDo List [Python Django]
Create a homepage with django
Create JIRA tickets using Python
Create a python numpy array
Create a Django login screen
Create a directory with python
Create a shogi game record management app using Django 4 ~ Create View ~
Probably the easiest way to create a pdf with Python3
Try a similar search for Image Search using the Python SDK [Search]
Create a real-time auto-reply bot using the Twitter Streaming API
How to generate a query using the IN operator in Django