[PYTHON] Creating a Shogi Game Record Management App Using Django 1-Environment Construction-

Introduction

Over the next few times, I'll be using Django to create a shogi game record management app!

Why did you decide to make it?

First of all, the first language I learned in earnest was Python, and I wanted to create something using it. That was when I thought, "I wish I could manage the game record of my game history," for my hobby, shogi.

So at first I used Flask to make it halfway, but when I heard the opinions of the people around me, I decided that "Django is definitely better!" And decided to remake it from scratch.

Here, I will spell out the work process as it is, including memorandums, so thank you.

Work environment

The working environment this time is as follows

Contents of this article

--Creating a virtual environment in Anaconda --Django settings --Git settings for managing Django

Create a virtual environment with Anaconda

I didn't know what Anaconda was in the first place (I put it in because I was told to put it in as an intern for ~~ 1day ~~). Therefore, I learned about Anaconda because it was described in detail in the following article. [[For beginners] Try creating a virtual environment with Anaconda] 1

I also referred to the following sites, including the installation of Django. [[Anaconda + Django] Try developing a web application with Python. ] 2

This time, I created a virtual environment called kifu_app.

$ anaconda -V
anaconda Command line client (version 1.7.2)

$ activate kifu_app

(kifu_app) $ python -V
Python 3.7.6

Django installation

It was easy to finish by referring to [the previous blog] 2.

Django settings

Create a Django project

I referred to the following article. [Master Django fastest part1] 3

Navigate to the directory where you want to create the project and type:

$ django-admin startproject kifu_app

You now have a project with the following directory structure!

- kifu_app_project/
    - kifu_app_project/
        - setting.py
        - urls.py
        - wsgi.py
        - __init__.py
    - manage.py

Creating an app

In the upper kifu_app_project directory, do the following:

$ python manage.py startapp kifu_app

Then the directory structure will be as follows.

- kifu_app_project/
    - kifu_app_project/
        - setting.py
        - urls.py
        - wsgi.py
        - __init__.py
    - manage.py
    - kifu_app
        - admin.py
        - apps.py
        - migrations
        - models.py
        - tests.py
        - views.py
        - __init__.py

Finally, add the following to setting.py: (It seems that it is a report that I made an app!)

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'kifu_app',     # <-Add this
]

Git integration

Anyway, I will make Git available after practice. This is also named kifu_app_project and I created a remote repository on GitHub.

For details such as commit, I referred to the following article. [How to use Django-Deployment ①-] 4

First, create a .gitignore file in kifu_app_project at the upper level. .gitignore removes specified files from tracking.

.gitignore


# Created by https://www.gitignore.io/api/django
# Edit at https://www.gitignore.io/?templates=django

### Django ###
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
db.sqlite3
db.sqlite3-journal
media

A site called [gitignore.io] 5 will create a template for what you should write in .gitignore.

When you're ready, make your first commit.

$ git init
Initialized empty Git repository in ~/djangogirls/.git/

$ git config --global user.name "Registered user name on Github"

$ git config --global user.email Github registered email address

$ git add --all .

$ git commit -m "My Django Girls app, first commit"
13 files changed, ~~~

$git remote add origin repository URL

$ git remote -v
origin repository URL

$ git push -u origin master

It's okay if you execute the commands in order from the top. There are other people who explain in detail, so please refer to that.

When I checked GitHub, it was definitely pushed!

Next time preview

Next time, we will go to [Database Settings] 6!

Recommended Posts

Creating a Shogi Game Record Management App Using Django 1-Environment Construction-
Create a shogi game record management app using Django 4 ~ Create View ~
Create a shogi game record management app using Django 6 ~ Template division ~
Create a shogi game record management app using Django 3 ~ Django default management site settings ~
Create a shogi game record management application using Django 5 ~ Pass DB data to Template ~
Django environment construction
Try creating a web application with Vue.js and Django (Mac)-(1) Environment construction, application creation
Build a Django development environment using pyenv-virtualenv on Mac
Django project environment construction
Steps from installing Python 3 to creating a Django app
Build a Python virtual environment using venv (Django + MySQL ①)
[Django] A pattern to add related records after creating a record
[AWS] I tried using EC2, RDS, Django. Environment construction from 1
Create a Todo app with Django ① Build an environment with Docker
Django development environment construction memo
django project development environment construction
Python: Introduction to Flask: Creating a number identification app using MNIST
Mac + Eclipse (PyDev) + Django environment construction
Creating a web application using Flask ②
Build a go environment using Docker
[Django] Memorandum of environment construction procedure
[For beginners] Django -Development environment construction-
Creating a simple table using prettytable
Implement a Django app on Hy
Creating a simple app with flask
Creating a web application using Flask ①
Using Chainer with CentOS7 [Environment construction]
Creating a learning model using MNIST
Creating a web application using Flask ③
Creating a web application using Flask ④
Python3.6 environment construction (using Win environment Anaconda)
I made a Dir en gray face classifier using TensorFlow --② Environment construction