Quantcast

Totally Lost on "python manage.py runserver"

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Totally Lost on "python manage.py runserver"

Michael Durkin
I am at a loss. My Google-Fu seems to be sub-par as I cannot find an answer to what I'm looking for.

I am running Ubuntu, using Python 3.6.0 (pyenv handles different Python versions for me), have installed SQLite and Apache and ran "pip install django" to get Django on my machine.

I have run through the Django tutorial on installation (https://docs.djangoproject.com/en/1.11/topics/install/#installing-official-release) and made it all the way to "python manage.py runserver". After running that line I get the following message through the shell that I simply do not understand:

~/Scripts/Django_Practice/mysite$ python manage.py runserver
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f0e6c4ce730>
Traceback (most recent call last):
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 31, in <module>
    from pysqlite2 import dbapi2 as Database
ModuleNotFoundError: No module named 'pysqlite2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 33, in <module>
    from sqlite3 import dbapi2 as Database
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/utils/autoreload.py", line 227, in wrapper
    fn(*args, **kwargs)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
    autoreload.raise_last_exception()
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/utils/autoreload.py", line 250, in raise_last_exception
    six.reraise(*_exception)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/utils/autoreload.py", line 227, in wrapper
    fn(*args, **kwargs)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models()
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/contrib/auth/models.py", line 4, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/contrib/auth/base_user.py", line 52, in <module>
    class AbstractBaseUser(models.Model):
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/models/base.py", line 124, in __new__
    new_class.add_to_class('_meta', Options(meta, app_label))
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/models/base.py", line 330, in add_to_class
    value.contribute_to_class(cls, name)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/models/options.py", line 214, in contribute_to_class
    self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/__init__.py", line 33, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/utils.py", line 211, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/utils.py", line 115, in load_backend
    return import_module('%s.base' % backend_name)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 35, in <module>
    raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s" % exc)
django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named '_sqlite3'


After reading the file listed in the error message (/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py) it makes me think I have a problem with SQLite, but again I'm at a loss. Completely stuck! Does anyone have the answer?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/46f9d3b2-2ced-4c41-93e1-25bc2f6848f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Totally Lost on "python manage.py runserver"

ludovic coues
Have you tried "sudo apt-get install sqlite" ?
The package might be called sqlite3 or sqlite-dev or something like that

2017-04-14 6:16 GMT+02:00 Michael Durkin <[hidden email]>:

> I am at a loss. My Google-Fu seems to be sub-par as I cannot find an answer
> to what I'm looking for.
>
> I am running Ubuntu, using Python 3.6.0 (pyenv handles different Python
> versions for me), have installed SQLite and Apache and ran "pip install
> django" to get Django on my machine.
>
> I have run through the Django tutorial on installation
> (https://docs.djangoproject.com/en/1.11/topics/install/#installing-official-release)
> and made it all the way to "python manage.py runserver". After running that
> line I get the following message through the shell that I simply do not
> understand:
>
> ~/Scripts/Django_Practice/mysite$ python manage.py runserver
> Unhandled exception in thread started by <function
> check_errors.<locals>.wrapper at 0x7f0e6c4ce730>
> Traceback (most recent call last):
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py",
> line 31, in <module>
>     from pysqlite2 import dbapi2 as Database
> ModuleNotFoundError: No module named 'pysqlite2'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py",
> line 33, in <module>
>     from sqlite3 import dbapi2 as Database
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/sqlite3/__init__.py", line
> 23, in <module>
>     from sqlite3.dbapi2 import *
>   File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/sqlite3/dbapi2.py",
> line 27, in <module>
>     from _sqlite3 import *
> ModuleNotFoundError: No module named '_sqlite3'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 227, in wrapper
>     fn(*args, **kwargs)
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
> line 117, in inner_run
>     autoreload.raise_last_exception()
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 250, in raise_last_exception
>     six.reraise(*_exception)
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/utils/six.py",
> line 685, in reraise
>     raise value.with_traceback(tb)
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 227, in wrapper
>     fn(*args, **kwargs)
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/__init__.py",
> line 27, in setup
>     apps.populate(settings.INSTALLED_APPS)
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/apps/registry.py",
> line 108, in populate
>     app_config.import_models()
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/apps/config.py",
> line 202, in import_models
>     self.models_module = import_module(models_module_name)
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/importlib/__init__.py",
> line 126, in import_module
>     return _bootstrap._gcd_import(name[level:], package, level)
>   File "<frozen importlib._bootstrap>", line 978, in _gcd_import
>   File "<frozen importlib._bootstrap>", line 961, in _find_and_load
>   File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
>   File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
>   File "<frozen importlib._bootstrap_external>", line 678, in exec_module
>   File "<frozen importlib._bootstrap>", line 205, in
> _call_with_frames_removed
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/contrib/auth/models.py",
> line 4, in <module>
>     from django.contrib.auth.base_user import AbstractBaseUser,
> BaseUserManager
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/contrib/auth/base_user.py",
> line 52, in <module>
>     class AbstractBaseUser(models.Model):
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/models/base.py",
> line 124, in __new__
>     new_class.add_to_class('_meta', Options(meta, app_label))
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/models/base.py",
> line 330, in add_to_class
>     value.contribute_to_class(cls, name)
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/models/options.py",
> line 214, in contribute_to_class
>     self.db_table = truncate_name(self.db_table,
> connection.ops.max_name_length())
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/__init__.py",
> line 33, in __getattr__
>     return getattr(connections[DEFAULT_DB_ALIAS], item)
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/utils.py",
> line 211, in __getitem__
>     backend = load_backend(db['ENGINE'])
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/utils.py",
> line 115, in load_backend
>     return import_module('%s.base' % backend_name)
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/importlib/__init__.py",
> line 126, in import_module
>     return _bootstrap._gcd_import(name[level:], package, level)
>   File
> "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py",
> line 35, in <module>
>     raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3
> modules (tried in that order): %s" % exc)
> django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2
> or sqlite3 modules (tried in that order): No module named '_sqlite3'
>
>
> After reading the file listed in the error message
> (/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py)
> it makes me think I have a problem with SQLite, but again I'm at a loss.
> Completely stuck! Does anyone have the answer?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [hidden email].
> To post to this group, send email to [hidden email].
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/46f9d3b2-2ced-4c41-93e1-25bc2f6848f2%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--

Cordialement, Ludovic Coues
+33 6 14 87 43 42

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEuG%2BTYX7f7mE2z3tciFhBa2k5Vq9rteC9%2Bv4b5fgPAXzQ8chg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Totally Lost on "python manage.py runserver"

Scot Hacker-2
In reply to this post by Michael Durkin
`pip install pysqlite2` ? 

./s

On Friday, April 14, 2017 at 5:07:06 AM UTC-7, Michael Durkin wrote:
I am at a loss. My Google-Fu seems to be sub-par as I cannot find an answer to what I'm looking for.

I am running Ubuntu, using Python 3.6.0 (pyenv handles different Python versions for me), have installed SQLite and Apache and ran "pip install django" to get Django on my machine.

I have run through the Django tutorial on installation (<a href="https://docs.djangoproject.com/en/1.11/topics/install/#installing-official-release" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdocs.djangoproject.com%2Fen%2F1.11%2Ftopics%2Finstall%2F%23installing-official-release\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFnJi8Z8Yq0xj0mntHjDLIuNBoySA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdocs.djangoproject.com%2Fen%2F1.11%2Ftopics%2Finstall%2F%23installing-official-release\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFnJi8Z8Yq0xj0mntHjDLIuNBoySA&#39;;return true;">https://docs.djangoproject.com/en/1.11/topics/install/#installing-official-release) and made it all the way to "python manage.py runserver". After running that line I get the following message through the shell that I simply do not understand:

~/Scripts/Django_Practice/mysite$ python manage.py runserver
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f0e6c4ce730>
Traceback (most recent call last):
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 31, in <module>
    from pysqlite2 import dbapi2 as Database
ModuleNotFoundError: No module named 'pysqlite2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 33, in <module>
    from sqlite3 import dbapi2 as Database
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/utils/autoreload.py", line 227, in wrapper
    fn(*args, **kwargs)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
    autoreload.raise_last_exception()
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/utils/autoreload.py", line 250, in raise_last_exception
    six.reraise(*_exception)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/utils/autoreload.py", line 227, in wrapper
    fn(*args, **kwargs)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models()
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/contrib/auth/models.py", line 4, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/contrib/auth/base_user.py", line 52, in <module>
    class AbstractBaseUser(models.Model):
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/models/base.py", line 124, in __new__
    new_class.add_to_class('_meta', Options(meta, app_label))
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/models/base.py", line 330, in add_to_class
    value.contribute_to_class(cls, name)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/models/options.py", line 214, in contribute_to_class
    self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/__init__.py", line 33, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/utils.py", line 211, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/utils.py", line 115, in load_backend
    return import_module('%s.base' % backend_name)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 35, in <module>
    raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s" % exc)
django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named '_sqlite3'


After reading the file listed in the error message (/home/durkin/.pyenv/versions/3.6.0/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py) it makes me think I have a problem with SQLite, but again I'm at a loss. Completely stuck! Does anyone have the answer?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e1b2fc00-4f76-490d-98d4-906c6da5e428%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...