I just started learning Django. My main source of knowledge about that framework is the book "Python Web Development with Django" by Rudolph Snellius, Jeff Forcier and Wesley Chun.
Can you explain to me how to use SQlite in Django? The book is a few years old, which is why I have some problems with configuring the database.
The first step I have done correctly was to create an app with the command ./manage.py startapp blog, then I added verse mojprojekt to tuple INSTALLED_APPS in setting.py file. Then I have to add verses DATABASE_ENGINE = 'sqlite3' and DATABASE_NAME = 'path to my project' to settings.py.
The last step is to run the command ./manage.py syncdb. After this I get an error:
konrad@konrad-MS-7823:~/Documents/Django/mojprojekt$ ./manage.py syncdb
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute()
File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 328, in execute
django.setup()
File "/usr/lib/python2.7/dist-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/lib/python2.7/dist-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/lib/python2.7/dist-packages/django/apps/config.py", line 119, in create
import_module(entry)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named blog
konrad@konrad-MS-7823:~/Documents/Django/mojprojekt$
Could you help me if you know where I made a mistake?
Update: Here is my application definition:
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'mojprojekt.blog',
)
This still gives the same result.
INSTALLED_APPSshould be the same name as in./manage.py startapp, so if youstartapp blog, it should be blog, but not themojproject