[PYTHON] [For beginners] Django -Development environment construction-

** Let's Django -Environmental Construction-**

There is a programming setback: building an environment is 7,000 times more difficult than you might think. I spent a lot of effort building the environment ... At that time, I was rushing in the style of moving my hands even if I didn't understand it, but recently I've finally caught up with my understanding, so I'd like to summarize it here. Don't think too hard, simply step by step to build your Django development environment.

** Premise **

――The author is Windows, so please read as appropriate for Mac users. --If you have already installed Python, skip the relevant section.

** Install Python to get started **

download

Access the URL below. https://www.python.org/ python_install.PNG

Select Latest: Python 3.8.3 for Download. python_install3.PNG

You've arrived at the Python 3.8.3 page. If you scroll to the bottom, you can see Files. python_install2.PNG

As you can see, you can download the source code for each Mac OS and Windows. This time, download the Windows x86-64 executable installer (for Windows 64bit). For Windows 32bit, select Windows x86 executable installer. Which is your Windows? You can check this by following the steps at here.

Installation

After the download is complete, launch the installer. python_install4.PNG

Check Add Python 3.8 to PATH to start the installation. python_install6.PNG

Installation is complete! python_install7.PNG

** What is a virtual environment? ** **

When developing with Python, it is often the case that the required modules and packages differ depending on the application. It's possible to put them all in one place, but that would be very cumbersome to manage. Also, if different module versions are mixed, it seems that problems due to different versions will occur. ** Virtual environment ** solves these problems. Have different virtual environments for different applications, such as Django 2.2 for web application A development and Django 3.0 for web application B development. Below are references.


From here, we will actually build a virtual environment. Go to any directory and then install virtualenv, which is needed to build the virtual environment.

C:\Users\User_name\my_django>pip install virtualenv
Collecting virtualenv
~
Successfully installed appdirs-1.4.4 distlib-0.3.0 virtualenv-20.0.21

Then execute the following command. This time we will create a virtual environment called myvenv.

C:\Users\User_name\my_django>virtualenv myvenv

Then do the following:

C:\Users\User_name\my_django>myvenv\Scripts\activate

Then, (myvenv) may be displayed on the left side of C. The virtual environment is now started. By the way, to disable it, execute the following command.

(myvenv)C:\Users\User_name\my_django>deactivate

** Install Django **

Install Django right away. After confirming that you are in the virtual environment, execute the following command.

(myvenv)C:\Users\User_name\my_django>pip install django
Collecting django
~
Successfully installed asgiref-3.2.7 django-3.0.6 sqlparse-0.3.1

Once Django is installed, you're done!

(myvenv) C:\Users\User_name\my_django>pip list
Package    Version
---------- -------
asgiref    3.2.7

Django 3.0.6 <-Django! pip 20.1.1 pytz 2020.1 setuptools 46.4.0 sqlparse 0.3.1 wheel 0.34.2

** What to do next **

Let's get in touch with Django as soon as the development environment is ready! If you are new to this, you can complete the tutorial by following the Official Documents and Django Girls Tutorial, or I wrote for myself in the past [Tutorial](https://qiita.com/Yi- You can also see Gaoqiao / items / c5b41d22907016ae1d0f) (Qiita maiden work)! (It also touches on how Django works, so if you don't mind!)

** References **

-Django Official Documentation

Recommended Posts

[For beginners] Django -Development environment construction-
Django development environment construction memo
Python3 environment construction (for beginners)
django project development environment construction
django environment construction
Construction of development environment for Choreonoid class
Django project environment construction
Python development environment construction
python2.7 development environment construction
[Memo] Django development environment
From 0 to Django development environment construction to basic operation
Easy-to-understand explanation of Python Web application (Django) even for beginners (1) [Environment construction]
Development environment suitable for ArcPy
Python environment construction For Mac
Docker + Django + React environment construction
Django environment development on Windows 10
[MEMO] [Development environment construction] Python
[For organizing] Python development environment
[MEMO] [Development environment construction] wine
Ansible environment construction For Mac
[Python] Django environment construction (pyenv + pyenv-virtualenv + Anaconda) for macOS
Mac + Eclipse (PyDev) + Django environment construction
[Django] Memorandum of environment construction procedure
Django beginners tried building an environment
[Python3] Development environment construction << Windows edition >>
Python development environment options for May 2020
Python development environment construction on macOS
[MEMO] [Development environment construction] Jupyter Notebook
Emacs settings for Python development environment
Python3 TensorFlow for Mac environment construction
Emacs Python development environment construction memo
Ubuntu Desktop 20.04 development environment construction memo
Development environment construction (2020 version, WSL2 + VcXsrv)
Construction of Cortex-M development environment for TOPPERS using Raspberry Pi
I made a development environment for Django 3.0 with Docker, Docker-compose, Poetry
[DynamoDB] [Docker] Build a development environment for DynamoDB and Django with docker-compose
Mac OS X Mavericks 10.9.5 Development environment construction
Python (anaconda) development environment construction procedure (SpringToolsSuites) _2020.4
Python development environment for macOS using venv 2016
Python project environment construction procedure (for windows)
Programming environment for beginners made on Windows
WEB application development using django-Development environment construction-
Django tutorial summary for beginners by beginners ③ (View)
Python3 + venv + VSCode + macOS development environment construction
Prepare the development environment for keyhac for Mac
Mac OS X Yosemite 10.10 Development environment construction
Mac OS X development environment construction memo
Environment construction for MXNet tutorial (gluon part)
Django tutorial summary for beginners by beginners ⑤ (test)
Building a Python development environment for AI development
Creating a development environment for machine learning
Windows + gVim + Poetry python development environment construction
DeepIE3D environment construction
Emacs-based environment construction
Linux environment construction
Create a Python development environment locally at the fastest speed (for beginners)
Roadmap for beginners
Python environment construction
Environment construction (python)
Django 1.9 for internationalization
CodeIgniter environment construction