[PYTHON] Django Getting Started: 2_ Project Creation

table of contents

Django Getting Started: 1_Environment Building Django Getting Started: 2_Project Creation Beginning with Django: 3_Apache integration Beginning with Django: 4_MySQL integration

Last time we proceeded to build the environment, so this time we will actually create a project. It's 100 times more useful to refer to the official tutorial than to summarize it.

Create your first Django app

I will summarize it for beginners like myself who find it difficult even with a formal polite explanation.

environment

Django configuration

Django has the concept of projects and applications. Roughly speaking, there are a number of applications in the project.

A project is the biggest concept, whether it's a site or system you want to create with Django. An application is a small feature (such as an article posting or voting system) within the site.

It seems that the smaller the particle size of the application, the better. Shred as much as possible and dedicate each application to one task. Loosely connect applications (do not depend on each other).

It seems that this makes it easy to divert the application to another project.

Project creation

So anyway, start by creating a project. Go to the appropriate dictator (make / home / django or something).

django-admin startproject PROJECT_NAME

Enter your favorite project name in PROJECT_NAME. However, avoid names that python might import, such as test and django, as they will batting. Also, it seems to avoid the apache document root as the place to create it.

Now, let's check it on the simple server for development (this one cannot be used for public use, it is for development only).

cd PROJECT_NAME
python manage.py runserver 0.0.0.0:8000

Become a Vagrant and access port 8000 of the IP address of the server running Django with your browser. http://192.168.0.2:8000 With a feeling. Or wget --spider -S localhost: 8000

Vagrant or the server running Django and the accessing PC are different It says DisallowedHost at ...

Add an authorized host to settings.py. Let's open it in an editor. This time, I will allow all of them for the time being.

ALLOWED_HOSTS = ['*']

If you access the browser again and the message "It worked!" Is displayed, it is successful.

Now, with this, we will continue to create applications and add various functions, but next time we will set up the DB and web server first. The hard things are limited to getting rid of them first.

Reference URL

Create your first Django app ALLOWED_HOSTS must be set in Django 1.5 and above

Recommended Posts

Django Getting Started: 2_ Project Creation
Getting Started with Django 1
Getting Started with Django 2
Django Getting Started: 1_Environment Building
Getting Started with Python Django (1)
Django Getting Started: 4_MySQL Integration
Django Getting Started: 3_Apache integration
Getting Started with Python Django (4)
Getting Started with Python Django (3)
Getting Started with Python Django (6)
Getting Started with Django with PyCharm
Getting Started with Python Django (5)
django table creation
Django Project Baseline
Grails getting started
Django tutorial summary for beginners by beginners ① (project creation ~)
Django Getting Started Part 2 with eclipse Plugin (PyDev)
Django Getting Started Part 3 about Python3 & MySQL Connector
Django 1.11 started with Python3.6
Getting started with Android!
Django project environment construction
1.1 Getting Started with Python
Getting Started with Golang 2
Django shift creation feature
Getting started with apache2
Getting Started with Golang 1
Getting Started with Python
Getting Started with Optimization
Django --start project without start project
Getting Started with Golang 3
[Django] Rename the project
Getting Started with Numpy
Getting started with Spark
Getting Started with Python
Start a Django project
Getting Started with Pydantic
Getting Started with Golang 4
Getting Started with Jython
Getting Started with Yocto Project with Raspberry Pi 4 and WSL2
Translate Getting Started With TensorFlow
Getting Started with Python Functions
Getting Started with Tkinter 2: Buttons
Getting Started with Go Assembly
[Linux] [Initial Settings] Getting Started
Getting Started with PKI with Golang ―― 4
Get started with Django! ~ Tutorial ④ ~
Shell to create django project
Web application creation with Django
Getting started and using sample class-based generic views in Django
Get started with Django! ~ Tutorial ⑥ ~
How to do the initial setup from Django project creation
django project development environment construction
Deploy django project to heroku
Python3 | Getting Started with numpy
Enable pip installation with Windows Azure website creation (Django project)
Getting Started with Heroku-Viewing Hello World in Python Django with Raspberry PI 3
Getting Started with Python responder v2
Steps to create a Django project
Getting Started with Git (1) History Storage
Getting started with Sphinx. Generate docstring with Sphinx
Getting Started with Python Web Applications