How to do the initial setup from Django project creation

From Django project creation to initial setup

I will explain from creating a project with Django to initial setting ^ _ ^

environment

Python 3.7.6 Django 3.0.5

Creating a project

First, change to the directory for creating the project. Therefore, create a project as shown below. At this time, the project name will be arbitrary, but this time it will be webproject. If you check the inside of the folder, you can see that manage.py is included.

ChisakinoMacBook-Pro:webapp Chisaki$ django-admin startproject webproject .
ChisakinoMacBook-Pro:webapp Chisaki$ ls
manage.py	webproject

Next, add folders as shown below. In this case as well, the name of the folder will be arbitrary, but this time it will be webapp.

ChisakinoMacBook-Pro:webapp Chisaki$ python3 manage.py startapp webapp
ChisakinoMacBook-Pro:webapp Chisaki$ ls
manage.py	webapp		webproject

Then add more folders for the template. This folder name can be arbitrary, but this time it will be templates.

ChisakinoMacBook-Pro:webapp Chisaki$ mkdir templates
ChisakinoMacBook-Pro:webapp Chisaki$ ls
manage.py	templates	webapp		webproject

The rough folder in the initial state looks like this ^ _ ^

Settings in the editor

Next is the editor settings! Open setting.py. This time, enter the folder name you added on the 40th line here. Let's add webapp. スクリーンショット 2020-04-28 18.28.04.png

Next, add the template folder you added to the 58th line like an image. スクリーンショット 2020-04-28 18.30.07.png

Next, move to urls.py in the web project. Describe as follows. Don't forget to add include on the second line at this time.

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('webapp.urls')),
]

Next, create urls.py directly under webapp. Then write as follows. This file will be used by connecting URLs in the future.

from django.urls import path

urlpatterns = [
    path('', ),
]

The above is the explanation from Django project creation to initial setting! Please refer to it ^ _ ^

Recommended Posts

How to do the initial setup from Django project creation
How to do arithmetic with Django template
How to operate Linux from the console
Django initial setup up to Intellij Debug
How to access the Datastore from the outside
How to do Server-Sent Events in Django
How to build an application from the cloud using the Django web framework
How to pass values to JavaScript variables directly from the [Django] template tag
How to print debug messages to the Django console
How to operate Linux from the outside Procedure
How to measure line speed from the terminal
[Django] Rename the project
[Python] How to remove duplicate values from the list
How to create an article from the command line
The wall of changing the Django service from Python 2.7 to Python 3
How to use Azure Table storage from Django (PTVS)
[Python] How to use the graph creation library Altair
How to instantly launch Jupyter Notebook from the terminal
How to post a ticket from the Shogun API
How to reference static files in a Django project
[Django] How to redirect unlogged-in users to the login page
How to write custom validations in the Django REST Framework
Django Getting Started: 2_ Project Creation
How to use the generator
Shell to create django project
How to calculate the amount of calculation learned from ABC134-D
How to log in automatically like 1Password from the CLI
How to generate a query using the IN operator in Django
How to hit NAPALM from the Web (NetDevOpsSec reality solution)
In Django, how to abbreviate the long displayed string as ....
Deploy django project to heroku
DJango Memo: From the beginning (more edits to the management screen)
How to use the decorator
How to increase the axis
How to start the program
Deploy Django + React from scratch to GKE (3) Create a GCP project
How to get followers and followers from python using the Mastodon API
[EC2] How to install and download chromedriver from the command line
How to extract the desired character string from a line 4 commands
How to resolve the error from toimage (from PIL.Image import fromarray as toimage)
[Tips] How to do template extends when creating HTML with django
[Python] How to do PCA in Python
How to use the zip function
[Note] Django project creation and terminology
How to use the optparse module
[Django] How to test Form [TDD]
Steps to create a Django project
DJango Memo: From the beginning (preparation)
How to read the SNLI dataset
How to get the Python version
[Python] How to import the library
How to reflect CSS in Django
How to get started with Django
How to launch Explorer from WSL
Get the value from the [Django] Form
Deploy the Django tutorial to IIS ①
How to overwrite the output to the console
How to access wikipedia from python
How to write Django1.9 environment-independent wsgi.py
How to convert from .mgz to .nii.gz
How to use the ConfigParser module