Django noob. Can you tell me what I am doing wrong here? I looked this up on google, and the closest issue I found was this and this -- but couldn't figure it out.
Is this a password issue? I have the mysql password on my settings.py
I appreciate your help.
j#ime:~/dotcloud$ dotcloud run jims.www python current/jims/manage.py syncdb
# python current/jims/manage.py syncdb
Traceback (most recent call last):
File "current/jims/manage.py", line 14, in <module>
execute_manager(settings)
File "/home/dotcloud/env/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/home/dotcloud/env/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/dotcloud/env/lib/python2.6/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/dotcloud/env/lib/python2.6/site-packages/django/core/management/base.py", line 219, in execute
self.validate()
File "/home/dotcloud/env/lib/python2.6/site-packages/django/core/management/base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
File "/home/dotcloud/env/lib/python2.6/site-packages/django/core/management/validation.py", line 102, in get_validation_errors
connection.validation.validate_field(e, opts, f)
File "/home/dotcloud/env/lib/python2.6/site-packages/django/db/backends/mysql/validation.py", line 14, in validate_field
db_version = self.connection.get_server_version()
File "/home/dotcloud/env/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 338, in get_server_version
self.cursor()
File "/home/dotcloud/env/lib/python2.6/site-packages/django/db/backends/__init__.py", line 250, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "/home/dotcloud/env/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 322, in _cursor
self.connection = Database.connect(**kwargs)
File "/home/dotcloud/env/lib/python2.6/site-packages/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "/home/dotcloud/env/lib/python2.6/site-packages/MySQLdb/connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'jims'#'ip-10-68-47-216.ec2.internal' (using password: YES)")
Abort.
Related
I have read questions in Stackoverflow and googled, but no luck.
I am trying to create a superuser in pycharm(manage.py createsuperuser
) but got below error:
"cassandra.protocol.SyntaxException: "
Not checking migrations as it is not possible to access/create the django_migrations table.
Traceback (most recent call last):
File "C:\Users\skum\PQP_Bridge\manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 363, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Python27\lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py", line 63, in execute
return super(Command, self).execute(*args, **options)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 330, in execute
output = self.handle(*args, **options)
File "C:\Python27\lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py", line 96, in handle
default_username = get_default_username()
File "C:\Python27\lib\site-packages\django\contrib\auth\management\__init__.py", line 148, in get_default_username
auth_app.User._default_manager.get(username=default_username)
File "C:\Python27\lib\site-packages\django\db\models\manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "C:\Python27\lib\site-packages\django\db\models\query.py", line 374, in get
num = len(clone)
File "C:\Python27\lib\site-packages\django\db\models\query.py", line 232, in __len__
self._fetch_all()
File "C:\Python27\lib\site-packages\django\db\models\query.py", line 1118, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "C:\Python27\lib\site-packages\django\db\models\query.py", line 53, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py", line 894, in execute_sql
raise original_exception
cassandra.protocol.SyntaxException: <Error from server: code=2000 [Syntax error in CQL query] message="line 1:260 no viable alternative at input '.' (
...auth_user.date_joined FROM auth_user WHERE [auth_user]....)">
what am I doing wrong?
I am using Cassandra 3.0, Python Django 1.11.4, and pycharm.
We can not use: python manage.py createsuperuser using Cassandra It do not work with default django model. You need to use external library for the same. user module does not work with Cassandra by default
Please read document on data-stax or below given link. https://pypi.python.org/pypi/django-cassandra-engine/
I want to move my django site to another machine.
(I want to start with empty DB)
I thought i'll be done with the following steps.
copy all files
setup all tools(django,python,..etc)
run syncdb
When I run manage.py syncdb, it complains some table(such as django_content_type) doesn't exist.
I looked at the DB, indeed there are no tables in the DB.
I tried recreate project(startproject) or recreate app(startapp).
(But they fail because the project or app name is already taken.)
What should I do?
The reason I can think of is mysql being upgraded to 5.5.27 (default to innodb)
$ python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/django/core/management/base.py", line 231, in execute
self.validate()
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/django/core/management/base.py", line 266, in validate
num_errors = get_validation_errors(s, app)
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/django/core/management/validation.py", line 30, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/django/db/models/loading.py", line 158, in get_app_errors
self._populate()
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/django/db/models/loading.py", line 64, in _populate
self.load_app(app_name, True)
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/django/db/models/loading.py", line 88, in load_app
models = import_module('.models', app_name)
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/ubuntu/Documents/aLittleArtist/django/gallery/models.py", line 152, in <module>
ALBUM_IMAGE_TYPE = ContentType.objects.get(app_label="gallery", model="AlbumImage")
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/django/db/models/manager.py", line 131, in get
return self.get_query_set().get(*args, **kwargs)
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/django/db/models/query.py", line 361, in get
num = len(clone)
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/django/db/models/query.py", line 85, in __len__
self._result_cache = list(self.iterator())
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/django/db/models/query.py", line 291, in iterator
for row in compiler.results_iter():
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 763, in results_iter
for rows in self.execute_sql(MULTI):
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 818, in execute_sql
cursor.execute(sql, params)
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/django/db/backends/util.py", line 40, in execute
return self.cursor.execute(sql, params)
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 114, in execute
return self.cursor.execute(query, args)
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 174, in execute
self.errorhandler(self, exc, value)
File "/home/ubuntu/virtualenvs/aLittleArtist/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
django.db.utils.DatabaseError: (1146, "Table 'gallery_db.django_content_type' doesn't exist")
ALBUM_IMAGE_TYPE = ContentType.objects.get(app_label="gallery", model="AlbumImage")
This line was the culprit.
seems like the above line attempts to do DB query before any DB table is created.
I removed the line and relevant code and let syncdb run. and did migrate with south.
I am trying to apply tutorial http://docs.django-cms.org/en/2.1.3/getting_started/tutorial.html.
But I didn't succeed to perform the initial database setup
Why do I get this error when I run "python manage.py syncdb --all" ?
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 381, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 195, in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 230, in execute
self.validate()
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 266, in validate
num_errors = get_validation_errors(s, app)
File "C:\Python27\lib\site-packages\django\core\management\validation.py", line 30, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "C:\Python27\lib\site-packages\django\db\models\loading.py", line 158, in get_app_errors
self._populate()
File "C:\Python27\lib\site-packages\django\db\models\loading.py", line 64, in _populate
self.load_app(app_name, True)
File "C:\Python27\lib\site-packages\django\db\models\loading.py", line 88, in load_app
models = import_module('.models', app_name)
File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 35, in import_module
__import__(name)
File "C:\Python27\lib\site-packages\django_cms-2.2-py2.7.egg\cms\plugins\link\models.py", line 5, in <module>
class Link(CMSPlugin):
File "C:\Python27\lib\site-packages\django_cms-2.2-py2.7.egg\cms\plugins\link\models.py", line 11, in Link
url = models.URLField(_("link"), verify_exists=False, blank=True, null=True)
File "C:\Python27\lib\site-packages\django\db\models\fields\__init__.py", line 1265, in __init__
CharField.__init__(self, verbose_name, name, **kwargs)
File "C:\Python27\lib\site-packages\django\db\models\fields\__init__.py", line 614, in __init__
super(CharField, self).__init__(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'verify_exists'
The verify_exists parameter for UrlField was deprecated in the 1.3.1 security release and removed in the current Git master (1.5dev). https://docs.djangoproject.com/en/1.4/internals/deprecation/. This makes this version of django-cms incompatible with the current master. I would recommend using a stable Django release such as the latest 1.4 rather than master.
Trying to create a war file from my django program, keep running into this error when running jython manage.py war:
jython manage.py war --include-java-libs "/home/user/Downloads/mysql-connector-java-5.1.18/mysql-connector-java-5.1.18-bin.jar"
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 219, in execute
self.validate()
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 219, in execute
self.validate()
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
File "/usr/lib/python2.7/site-packages/django/core/management/validation.py", line 28, in get_validation_errors
from django.db import models, connection
File "/usr/lib/python2.7/site-packages/django/db/__init__.py", line 78, in <module>
connection = connections[DEFAULT_DB_ALIAS]
File "/usr/lib/python2.7/site-packages/django/db/utils.py", line 94, in __getitem__
conn = backend.DatabaseWrapper(db, alias)
File "/usr/lib/python2.7/site-packages/doj/backends/zxjdbc/mysql/base.py", line 152, in __init__
self.features = DatabaseFeatures()
TypeError: __init__() takes exactly 2 arguments (1 given)
Any help would be greatly appreciated!
Appears to be a known bug, hopefully taken care of soon.
http://code.google.com/p/django-jython/issues/detail?id=56&q=mysql
Why do I get this error when I run manage.py validate?:
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "C:\python26\lib\site-packages\django\core\management\__init__.py", line
438, in execute_manager
utility.execute()
File "C:\python26\lib\site-packages\django\core\management\__init__.py", line
379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\python26\lib\site-packages\django\core\management\base.py", line 191,
in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\python26\lib\site-packages\django\core\management\base.py", line 218,
in execute
output = self.handle(*args, **options)
File "C:\python26\lib\site-packages\django\core\management\base.py", line 347,
in handle
return self.handle_noargs(**options)
File "C:\python26\lib\site-packages\django\core\management\commands\validate.p
y", line 9, in handle_noargs
self.validate(display_num_errors=True)
File "C:\python26\lib\site-packages\django\core\management\base.py", line 245,
in validate
num_errors = get_validation_errors(s, app)
File "C:\python26\lib\site-packages\django\core\management\validation.py", lin
e 28, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "C:\python26\lib\site-packages\django\db\models\loading.py", line 146, in
get_app_errors
self._populate()
File "C:\python26\lib\site-packages\django\db\models\loading.py", line 61, in
_populate
self.load_app(app_name, True)
File "C:\python26\lib\site-packages\django\db\models\loading.py", line 78, in
load_app
models = import_module('.models', app_name)
File "C:\python26\lib\site-packages\django\utils\importlib.py", line 35, in im
port_module
__import__(name)
File "C:\projects\mysite\..\mysite\books\models.py", line 5, in <module>
class Publisher(models.Model):
File "C:\projects\mysite\..\mysite\books\models.py", line 6, in Publisher
name = models.CharField(maxlength=30)
File "C:\python26\lib\site-packages\django\db\models\fields\__init__.py", line
542, in __init__
super(CharField, self).__init__(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'maxlength'
The problem is that you are using a newer version of Django now. Since 1.0 (or actually, somewhere in 0.97) Django switched to max_length instead of maxlength. So either upgrade your code or install Django 0.96 for it to work again.
It's difficult to be 100% sure, because you haven't included the code in mysite/books/models.py, but it would appear that the 'max_length' keyword argument to a CharField in the Publisher class has been misspelled 'maxlength'.
See here for the correct values:
http://docs.djangoproject.com/en/dev/ref/models/fields/#charfield