I thought that I was studying the configuration of Django, and when I searched on Github, it seemed interesting, so I tried it. This is my first time to do a start project based on django's project template.
See Github Sam's Django Project Template
Originally it seems like this. It is based on the project_template shipped with stable/1.5.x and modified for Django 1.9.
feature is,
sudo apt-get install postgresql-9.5
sudo apt-get install postgresql-server-dev-9.5
$ virtualenv env
$ source env/bin/activate
pip install $ pip install -r https://raw.github.com/sjkingo/django-project-template/master/requirements.txt $ pip install -r https://raw.github.com/sjkingo/django-project-template/master/requirements-dev.txt
Here, these three and one are included.
django-admin.py startproject --template https://github.com/sjkingo/django-project-template/archive/master.zip $PROJECT_NAME
The execution was completed easily, and these were completed.
$ ls foo
README.md manage.py requirements.txt urls.py
__init__.py requirements-dev.txt settings wsgi.py
$ cd $PROJECT_NAME
$ pip freeze > requirements.txt
$ rm -f README.md
$ chmod +x manage.py
If you do so far and ./manage.py runserver, you will get a DB error. Because I haven't set it yet. .. ..
It's rarely done, so it's always easy to forget.
What is created after installation is Default user: postgres
Postgresql settings in Django, here, I made a note myself.
systemctl enable postgresql-9.5
postgres=# create database hoge;
CREATE DATABASE
postgres=# \l
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+----------------------- hoge | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | postgres | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | template0 | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres (4 rows)
$ createuser -a piyo
postgres=# \password piyo
Enter new password:
Enter it again:
Settings such as name in settings / base.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'hoge',
'USER': 'piyo',
'PASSWORD': 'piyo',
'HOST' : '127.0.0.1',
'PORT' : 5432,
}
}
From the Explosive REST page, set the model and add the management screen settings.
You can now see a slightly grappelli-like management screen.
First up to here.
Recommended Posts