Django에서 postgresql 및 실행 코드 설정
4001 단어 데이터베이스
postgresql 데이터베이스 만들기
ubuntuq@ubuntuq-HP-Compaq-6910p-RH241AV:~$ su postgres
:
postgres@ubuntuq-HP-Compaq-6910p-RH241AV:/home/ubuntuq$ psql
psql (9.3.11)
Type "help" for help.
postgres=# CREATE DATABASE pol_gov_mon owner deploy;
CREATE DATABASE
postgres=#
django에postgresql 데이터베이스 정보 설정하기
PostgreSQL의 데이터베이스 정보를django 설정에 settings.py 부분 코드는 다음과 같습니다.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'pol_gov_mon',
'USER': 'deploy',
'PASSWORD': 'XXX',
'HOST': '127.0.0.1',
'PORT': '5432',
#'CONN_MAX_AGE': 5,
}
}
django에서 데이터베이스 이동 및 실행 코드
ubuntuq@ubuntuq-HP-Compaq-6910p-RH241AV:~/ /wuran$ python manage.py syncdb
#
Creating tables ...
Creating table django_admin_log
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table jiandu_gov_pol_air_result
Creating table jiandu_gov_pol_water_result
Creating table jiandu_gov_pol_mental_result
Creating table jiandu_gov_pol_danger_result
You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'ubuntuq'): #
Email address: #
Password:
Password (again):
Error: Blank passwords aren't allowed.
Password: #
Password (again):#
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
ubuntuq@ubuntuq-HP-Compaq-6910p-RH241AV:~/ /wuran$ python manage.py xinjiang getall
#
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
SQLite의 query로 망설임이것은 내가 처음 안드로이드 응용 프로그램 개발에서 망설이고, 그 후 해결 된 방법을 비망록으로 철자하고 있습니다. java에서 SQLite를 이용한 애플리케이션을 작성하는 동안 EditText에 입력된 item이 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.