baza danych mysite
będzie w systemie plików się w głównym katalogu projektu (top większości folderze projektu Django), jeśli jest to w jaki sposób settings.py
wygląda następująco: -
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'mysite', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
Jeśli włączono Twój administrator django i napisz odpowiednie pliki admin.py do swojej aplikacji ankiety, powinieneś być w stanie dodawać, edytować, usuwać lub przeglądać dane ankiet w administratorze django.
Można oczywiście załadować bazę danych mysite
w katalogu głównym projektu Django (top folderu) i przeglądać dane w nim za pomocą czegoś podobnego http://sqlitebrowser.sourceforge.net/
W wierszu poleceń w terminalu Ubuntu, jeśli nie zrobić swoją syncdb poprawnie, powinieneś widzieć coś podobnego do tego: -
calvin$ ./manage.py syncdb
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
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 'calvin'): calvin
E-mail address: [email protected]
Password:
Password (again):
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
Wspomniałeś już uruchomić ./manage.py syncdb
prawidłowo, więc powinieneś być w stanie dostęp do bazy danych SQLite wykonując sqlite mysite
, tak: -
calvin$ sqlite3 mysite
SQLite version 3.7.14.1 2012-10-04 19:37:12
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
i polecenie w powłoce sqlite .tables
daje: -
sqlite> .tables
auth_group auth_user_user_permissions
auth_group_permissions django_content_type
auth_permission django_session
auth_user django_site
auth_user_groups
sqlite>
Dziękuję, to jest niesamowite. – sayth
witamy. cieszę się, że to rozwiązanie pomogło –