DJango Memo: From the beginning (preparation)

I used to refer to a certain book before, but I was able to do something else on the way, so I left a lot of time. I don't remember what I did at that time, so I decided to start over.

http://www.djangoproject.jp/ This time, I will proceed according to the tutorial on this page (because I am a little worried that the book I used to refer to will cause an error if I do it as described).

Installation procedure

It's already in, but for the time being https://www.djangoproject.com/download/

Tutorial 1 (Preparation)

http://www.djangoproject.jp/doc/ja/1.0/intro/tutorial01.html#intro-tutorial01

Creating a project

django-admin.py startproject [mysite]

[mysite](\ __ init__.py manage.py settings.py urls.py and directory containing wsgi.py) is created

Start development server

python manage.py runserver

This is OK. Connect to the displayed URL (http://127.0.0.1:8000/) to open the test page.

Set up database

Edit settings.py (this time with SQLite which seems to be the easiest)

DATABASES = {
   'default': {
      'ENGINE': 'django.db.backends.sqlite3',
              #mainly'postgresql_psycopg2' 'mysql' 'sqlite3'Any of
      'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
            #DB name (full path to DB file only for sqlite)
      # 'DATABASE_USER':"DB user name",   #Not needed in SQLite
      # 'DATABASE_PASSWORD':"DB password",   #Same as above
      # 'DATABASE_HOST':"Host with DB (empty is OK if the DB server is on the same machine)"   #Same as above
   }
}

After that, create a database with the following command

python manage.py syncdb

A database is created for each app in INSTALLED_APPS in settings.py

For the time being, this is all for today

Next, we will start with "Creating a model".

Recommended Posts

DJango Memo: From the beginning (preparation)
DJango Memo: From the beginning (creating a view)
DJango Memo: From the beginning (Error screen settings)
DJango Memo: From the beginning (more edits to the management screen)
DJango Note: From the beginning (form processing)
Django memo # 1 from scratch
DJango memo: From the beginning (using the management screen) my addictive point
DJango memo: From the beginning (editing the management screen) There is a mystery
DJango Note: From the beginning (using a generic view)
DJango Note: From the beginning (creating a view from a template)
DJango Note: From the beginning (simplification and splitting of URLConf)
Get the value from the [Django] Form
Learning notes from the beginning of Python 1
Omit BOM from the beginning of the string
Learning notes from the beginning of Python 2
Get only the text from the Django form.
Django Learning Memo
django tutorial memo
Finding the beginning of Abenomics from NT magnification 2
Finding the beginning of Abenomics from NT magnification 1
The beginning of cif2cell
Analyze the illustration (Memo)
The wall of changing the Django service from Python 2.7 to Python 3
heroku deployment memo (Django)
Learn Nim with Python (from the beginning of the year).
Study from the beginning of Python Hour1: Hello World
Mathematical understanding of principal component analysis from the beginning
[Django] Rename the project
Study from the beginning of Python Hour8: Using packages
A memo when Django was released on VPS (preparation)
[Memo] Django development environment
The story of a Django model field disappearing from a class
How to do the initial setup from Django project creation
Django starting from scratch (part: 2)
Let's search from the procession
Django development environment construction memo
Remove the frame from the image
I tweeted from the terminal!
Use django model from interpreter
Template registration from Django Bootstrap
[Learning memo] Django command summary
Create custom Django commands and run them from the command line
Carefully derive the interquartile range of the standard normal distribution from the beginning