OperationalError when converting from sqlite3 to postgresql - python

I tried changing my db from sqlite3 to postgresql using this tutorial:
https://tutorial-extensions.djangogirls.org/en/optional_postgresql_installation/
but when i try to migrate i get the following error
Traceback (most recent call last):
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\db\backends\base\base.py", line 213, in ensure_connection
self.connect()
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\db\backends\base\base.py", line 189, in connect
self.connection = self.get_new_connection(conn_params)
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\db\backends\postgresql\base.py", line 176, in get_new_connection
connection = Database.connect(**conn_params)
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
psycopg2\__init__.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\core\management\__init__.py", line 364, in execute_from_command_line
utility.execute()
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\core\management\__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\core\management\base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\core\management\base.py", line 330, in execute
output = self.handle(*args, **options)
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\core\management\commands\migrate.py", line 83, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\db\migrations\executor.py", line 20, in __init__
self.loader = MigrationLoader(self.connection)
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\db\migrations\loader.py", line 52, in __init__
self.build_graph()
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\db\migrations\loader.py", line 209, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\db\migrations\recorder.py", line 65, in applied_migrations
self.ensure_schema()
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\db\migrations\recorder.py", line 52, in ensure_schema
if self.Migration._meta.db_table in self.connection.introspection.table_name
s(self.connection.cursor()):
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\db\backends\base\base.py", line 254, in cursor
return self._cursor()
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\db\backends\base\base.py", line 229, in _cursor
self.ensure_connection()
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\db\backends\base\base.py", line 213, in ensure_connection
self.connect()
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\db\utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\utils\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\db\backends\base\base.py", line 213, in ensure_connection
self.connect()
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\db\backends\base\base.py", line 189, in connect
self.connection = self.get_new_connection(conn_params)
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
django\db\backends\postgresql\base.py", line 176, in get_new_connection
connection = Database.connect(**conn_params)
File "c:\Users\gudat\Documents\Arbeit\Szenario\Python\venv1\lib\site-packages\
psycopg2\__init__.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError
in my settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'dbase',
'USER': 'name',
'PASSWORD': 'test',
'HOST': 'localhost',
'PORT': '5432',
}
}
(yes i had the name changed)
Using Python 3.6.3 and psycopg2 (2.7.4).
What am i doing wrong?

Related

django.db.utils.OperationalError: fe_sendauth: no password supplied despite having supplied password in settings.py

I am trying to do python manage.py migrate to do migrations for my django app but i keep getting this error even though i have supplied the db name, user, password in settings.py.
Any help will be appreciated.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'accountant',
'USER': 'json',
'PASSWORD': '******',
'HOST': 'localhost',
'PORT': '5432'
}
}
Full stacktrace:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/json/anaconda3/envs/py33/lib/python3.8/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute()
File "/home/json/anaconda3/envs/py33/lib/python3.8/site-packages/django/core/management/__init__.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/json/anaconda3/envs/py33/lib/python3.8/site-packages/django/core/management/base.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/json/anaconda3/envs/py33/lib/python3.8/site-packages/django/core/management/base.py", line 445, in execute
output = self.handle(*args, **options)
File "/home/json/anaconda3/envs/py33/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 93, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/home/json/anaconda3/envs/py33/lib/python3.8/site-packages/django/db/migrations/executor.py", line 19, in __init__
self.loader = MigrationLoader(self.connection)
File "/home/json/anaconda3/envs/py33/lib/python3.8/site-packages/django/db/migrations/loader.py", line 47, in __init__
self.build_graph()
File "/home/json/anaconda3/envs/py33/lib/python3.8/site-packages/django/db/migrations/loader.py", line 191, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "/home/json/anaconda3/envs/py33/lib/python3.8/site-packages/django/db/migrations/recorder.py", line 59, in applied_migrations
self.ensure_schema()
File "/home/json/anaconda3/envs/py33/lib/python3.8/site-packages/django/db/migrations/recorder.py", line 49, in ensure_schema
if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):
File "/home/json/anaconda3/envs/py33/lib/python3.8/site-packages/django/db/backends/base/base.py", line 162, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "/home/json/anaconda3/envs/py33/lib/python3.8/site-packages/django/db/backends/base/base.py", line 135, in _cursor
self.ensure_connection()
File "/home/json/anaconda3/envs/py33/lib/python3.8/site-packages/django/db/backends/base/base.py", line 130, in ensure_connection
self.connect()
File "/home/json/anaconda3/envs/py33/lib/python3.8/site-packages/django/db/utils.py", line 98, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/json/anaconda3/envs/py33/lib/python3.8/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/home/json/anaconda3/envs/py33/lib/python3.8/site-packages/django/db/backends/base/base.py", line 130, in ensure_connection
self.connect()
File "/home/json/anaconda3/envs/py33/lib/python3.8/site-packages/django/db/backends/base/base.py", line 119, in connect
self.connection = self.get_new_connection(conn_params)
File "/home/json/anaconda3/envs/py33/lib/python3.8/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 176, in get_new_connection
connection = Database.connect(**conn_params)
File "/home/json/anaconda3/envs/py33/lib/python3.8/site-packages/psycopg2/__init__.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: fe_sendauth: no password supplied

Migration error(django.db.utils.OperationalError)

I'm trying to migrate my custom user model and I run makemigrations command to make migrations for new models. But when I run migrate command it throws this error :
conn = _connect(dsn, connection_factory=connection_factory,
**kwasync) django.db.utils.OperationalError
Trace back:
(venv_ruling) C:\Users\enosh\venv_ruling\ruling>python manage.py migrate
Traceback (most recent call last):
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\db\backends\base\base.py", line 219, in ensure_connection
self.connect()
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\utils\asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\db\backends\base\base.py", line 200, in connect
self.connection = self.get_new_connection(conn_params)
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\utils\asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\db\backends\postgresql\base.py", line 187, in get_new_connection
connection = Database.connect(**conn_params)
File "C:\Users\enosh\venv_ruling\lib\site-packages\psycopg2\__init__.py", line 127, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\enosh\venv_ruling\ruling\manage.py", line 22, in <module>
main()
File "C:\Users\enosh\venv_ruling\ruling\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line
utility.execute()
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\core\management\__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\core\management\base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\core\management\base.py", line 398, in execute
output = self.handle(*args, **options)
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\core\management\base.py", line 89, in wrapped
res = handle_func(*args, **kwargs)
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\core\management\commands\migrate.py", line 75, in handle
self.check(databases=[database])
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\core\management\base.py", line 419, in check
all_issues = checks.run_checks(
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\core\checks\registry.py", line 76, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\core\checks\model_checks.py", line 34, in check_all_models
errors.extend(model.check(**kwargs))
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\db\models\base.py", line 1290, in check
*cls._check_indexes(databases),
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\db\models\base.py", line 1680, in _check_indexes
connection.features.supports_covering_indexes or
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\db\backends\postgresql\features.py", line 93, in is_postgresql_11
return self.connection.pg_version >= 110000
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\db\backends\postgresql\base.py", line 329, in pg_version
with self.temporary_connection():
File "C:\Users\enosh\AppData\Local\Programs\Python\Python39\lib\contextlib.py", line 117, in __enter__
return next(self.gen)
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\db\backends\base\base.py", line 603, in temporary_connection
with self.cursor() as cursor:
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\utils\asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\db\backends\base\base.py", line 259, in cursor
return self._cursor()
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\db\backends\base\base.py", line 235, in _cursor
self.ensure_connection()
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\utils\asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\db\backends\base\base.py", line 219, in ensure_connection
self.connect()
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\db\utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\db\backends\base\base.py", line 219, in ensure_connection
self.connect()
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\utils\asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\db\backends\base\base.py", line 200, in connect
self.connection = self.get_new_connection(conn_params)
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\utils\asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "C:\Users\enosh\venv_ruling\lib\site-packages\django\db\backends\postgresql\base.py", line 187, in get_new_connection
connection = Database.connect(**conn_params)
File "C:\Users\enosh\venv_ruling\lib\site-packages\psycopg2\__init__.py", line 127, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError
models.py
from django.contrib.auth.models import AbstractUser
class CustomUser(AbstractUser):
"""extend usermodel"""
class Meta:
verbose_name_plural = 'CustomUser'
settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'rulings',
'USER': 'xxxxxxx',
'PASSWORD': 'xxxxxxx',
'HOST': '',
'PORT': '',
}
}
AUTH_USER_MODEL = 'accounts.CustomUser'
The postgresql's database is empty.(ver.12.6)
I just mentioned user model and settings in this question but still if more code is required then tell me I'll update my question with that information. Thank you
I don't know if you have left the port empty for the question or it is actually empty, but try this in the console and see if the connection is successful.
conn=psycopg2.connect(database="rulings", user="xxx", password="xxx",port=5432)
Also this might not be your port(it is the default but yours might be changed) check your port number \conninfo in the postgres shell. And let me know if it helps.
You have to check for the host_ip or the port number in the settings.py file of django.

FATAL: password authentication failed for user "postgres" while running makemigrations

getting the below error while running makemigrations
Traceback (most recent call last):
File "/home/siva/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection
self.connect()
File "/home/siva/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 195, in connect
self.connection = self.get_new_connection(conn_params)
File "/home/siva/venv/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 178, in get_new_connection
connection = Database.connect(**conn_params)
File "/home/siva/venv/lib/python3.8/site-packages/psycopg2/init.py", line 127, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: FATAL: password authentication failed for user "postgres"
FATAL: password authentication failed for user "postgres"
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/home/siva/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/home/siva/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/siva/venv/lib/python3.8/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/siva/venv/lib/python3.8/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/home/siva/venv/lib/python3.8/site-packages/django/core/management/base.py", line 83, in wrapped
res = handle_func(*args, **kwargs)
File "/home/siva/venv/lib/python3.8/site-packages/django/core/management/commands/makemigrations.py", line 101, in handle
loader.check_consistent_history(connection)
File "/home/siva/venv/lib/python3.8/site-packages/django/db/migrations/loader.py", line 283, in check_consistent_history
applied = recorder.applied_migrations()
File "/home/siva/venv/lib/python3.8/site-packages/django/db/migrations/recorder.py", line 73, in applied_migrations
if self.has_table():
File "/home/siva/venv/lib/python3.8/site-packages/django/db/migrations/recorder.py", line 56, in has_table
return self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor())
File "/home/siva/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 256, in cursor
return self._cursor()
File "/home/siva/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 233, in _cursor
self.ensure_connection()
File "/home/siva/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection
self.connect()
File "/home/siva/venv/lib/python3.8/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/siva/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection
self.connect()
File "/home/siva/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 195, in connect
self.connection = self.get_new_connection(conn_params)
File "/home/siva/venv/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 178, in get_new_connection
connection = Database.connect(**conn_params)
File "/home/siva/venv/lib/python3.8/site-packages/psycopg2/__init__.py", line 127, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: FATAL: password authentication failed for user "postgres"
FATAL: password authentication failed for user "postgres"
code in my settings file to import
try:
from .local_settings import *
except ImportError:
pass
Did you check your settings.py DATABASES dict?
It should contain your password as a string, so including quotation marks ('').

Problem uploading django project to heroku: Configuring Postgres

I'm trying to deploy a Django application to Heroku, but the heroku returns the message when i run the migrate command on the heroku bash:
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
res = handle_func(*args, **kwargs)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 82, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/executor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/loader.py", line 49, in __init__
self.build_graph()
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/loader.py", line 212, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 61, in applied_migrations
if self.has_table():
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 44, in has_table
return self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor())
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/base/base.py", line 255, in cursor
return self._cursor()
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/base/base.py", line 232, in _cursor
self.ensure_connection()
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
self.connect()
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
self.connect()
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/base/base.py", line 194, in connect
self.connection = self.get_new_connection(conn_params)
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/postgresql/base.py", line 178, in get_new_connection
connection = Database.connect(**conn_params)
File "/app/.heroku/python/lib/python3.6/site-packages/psycopg2/__init__.py", line 126, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: could not translate host name "postgres://baz" to address: Name or service not known
I think is something wrong with my settings:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': config('DB_NAME'),
'USER': config('DB_USER'),
'PASSWORD': config('DB_PASS'),
'HOST': 'localhost',
'PORT': config('DB_PORT'),
}
}
is that right? What do i must do to configure this?

Failing to open localhost page

I try to install django in my mac pro and I finished installing but when I want to run this command :
python manage.py runserver
Stack Feedback:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/core/management/base.py", line 393, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/core/management/base.py", line 444, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/core/management/commands/syncdb.py", line 25, in handle
call_command("migrate", **options)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/core/management/__init__.py", line 120, in call_command
return command.execute(*args, **defaults)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/core/management/base.py", line 444, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/core/management/commands/migrate.py", line 93, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/migrations/executor.py", line 19, in __init__
self.loader = MigrationLoader(self.connection)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/migrations/loader.py", line 47, in __init__
self.build_graph()
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/migrations/loader.py", line 182, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/migrations/recorder.py", line 59, in applied_migrations
self.ensure_schema()
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/migrations/recorder.py", line 49, in ensure_schema
if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/backends/base/base.py", line 162, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/backends/base/base.py", line 135, in _cursor
self.ensure_connection()
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/backends/base/base.py", line 130, in ensure_connection
self.connect()
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/utils.py", line 97, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/backends/base/base.py", line 130, in ensure_connection
self.connect()
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/backends/base/base.py", line 119, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/backends/sqlite3/base.py", line 204, in get_new_connection
conn = Database.connect(**conn_params)
django.db.utils.OperationalError: unable to open database file
I then tried my sqlite3 in the python, it works.
So I wanna how can I do it?

Categories