OpenEDX CMS, we're having trouble rendering your component - django

I have manually installed the full OpenEdx stack, but when trying to edit an existing unit (creating one works), I get the following error:
Here is the exception stack from the logs:
Oct 3 16:47:51 ip-xxx [service_variant=cms][contentstore.views.preview][env:sandbox] WARNING [ip-xxx 17550] [preview.py:318] - Unable to render author_view for <VerticalBlockWithMixins #9018 graded=False, annotation_token_secret=u'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', hide_after_due=False, giturl=None, edxnotes=False, source_file=None, course_edit_method=u'Studio', default_tab=None, children=[BlockUsageLocator(CourseLocator(u'Company', u'TD101', u'2018', None, None), u'html', u'8ca5de5b3eae4d95bae0df2c4c67ccce')], in_entrance_exam=False, showanswer=u'finished', display_name=u'Unit', video_speed_optimizations=True, graceperiod=None, format=None, due=None, start=datetime.datetime(2018, 5, 3, 17, 11, tzinfo=tzutc()), xml_attributes={u'filename': [u'vertical/693fb3e8136844e7a3e8c844ece0c0ae.xml', u'vertical/693fb3e8136844e7a3e8c844ece0c0ae.xml']}, days_early_for_beta=None, visible_to_staff_only=False, parent=BlockUsageLocator(CourseLocator(u'Company', u'TD101', u'2018', None, None), u'sequential', u'd7f0672550ec45f9adb6a3e504b6c8fc'), tags=[], matlab_api_key=None, xqa_key=None, is_entrance_exam=False, annotation_storage_url=u'http://your_annotation_storage.com', use_latex_compiler=False, video_bumper={}, show_correctness=u'always', static_asset_path=u'', hide_from_toc=False, show_reset_button=False, name=None, group_access={}, video_auto_advance=False, rerandomize=u'never', user_partitions=[], chrome=None, edxnotes_visibility=True, position=None, max_attempts=None, self_paced=False>
Traceback (most recent call last):
File "/edx/app/edxapp/edx-platform/cms/djangoapps/contentstore/views/preview.py", line 316, in get_preview_fragment
fragment = module.render(preview_view, context)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/xblock/core.py", line 202, in render
return self.runtime.render(self, view, context)
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1903, in render
return self.__getattr__('render')(block, view_name, context)
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1310, in render
return super(MetricsMixin, self).render(block, view_name, context=context)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/xblock/runtime.py", line 812, in render
updated_frag = self.wrap_xblock(block, view_name, frag, context)
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1262, in wrap_xblock
frag = wrapper(block, view, frag, context)
File "/edx/app/edxapp/edx-platform/openedx/core/lib/xblock_utils/__init__.py", line 259, in replace_static_urls
static_asset_path=static_asset_path
File "/edx/app/edxapp/edx-platform/common/djangoapps/static_replace/__init__.py", line 218, in replace_static_urls
return process_static_urls(text, replace_static_url, data_dir=static_asset_path or data_directory)
File "/edx/app/edxapp/edx-platform/common/djangoapps/static_replace/__init__.py", line 130, in process_static_urls
text
File "/edx/app/edxapp/venvs/edxapp/lib/python2.7/re.py", line 155, in sub
return _compile(pattern, flags).sub(repl, string, count)
File "/edx/app/edxapp/edx-platform/common/djangoapps/static_replace/__init__.py", line 122, in wrap_part_extraction
return replacement_function(original, prefix, quote, rest)
File "/edx/app/edxapp/edx-platform/common/djangoapps/static_replace/__init__.py", line 188, in replace_static_url
url = staticfiles_storage.url(rest)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/contrib/staticfiles/storage.py", line 162, in url
return self._url(self.stored_name, name, force)
File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/theming/storage.py", line 180, in _url
return super(ThemeCachedFilesMixin, self)._url(hashed_name_func, processed_asset_name, force, hashed_files)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/contrib/staticfiles/storage.py", line 141, in _url
hashed_name = hashed_name_func(*args)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/contrib/staticfiles/storage.py", line 376, in stored_name
raise ValueError("The name '%s' could not be hashed with %r." % (name, self))
ValueError: The name 'bundles/js/factories/xblock_validation.788ba995ff95.js' could not be hashed with <openedx.core.storage.ProductionStorage object at 0x7f524dd4b290>.
Any idea how to solve that, it seems to be an issue inside Django, but I can't find any information about it.

Related

PhpStorm Unknown exception encountered with possibly-broken third-party extension hg4ideapromptextension

I would like to know how to disable the third-party extension hg4ideapromptextension
I am using Xubuntu 17.10, Mercurial Distributed SCM (version 4.3.1), PhpStorm 10.0.4 and Python 2.7.14.
FYI, this was working fine until upgrade to Xubuntu 17.10
Here is the error I get
pushing to https://<user>#<my_redmine_server>
** Unknown exception encountered with possibly-broken third-party extension hg4ideapromptextension
** which supports versions unknown of Mercurial.
** Please disable hg4ideapromptextension and try your action again.
** If that fixes the bug please report it to the extension author.
** Python 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0]
** Mercurial Distributed SCM (version 4.3.1)
** Extensions loaded: strip, mq, hg4ideapromptextension Traceback (most recent call last): File "/usr/bin/hg", line 45, in <module>
mercurial.dispatch.run() File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 81, in run
status = (dispatch(req) or 0) & 255 File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 162, in dispatch
ret = _runcatch(req) File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 302, in
_runcatch
return _callcatch(ui, _runcatchfunc) File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 310, in
_callcatch
return scmutil.callcatch(ui, func) File "/usr/lib/python2.7/dist-packages/mercurial/scmutil.py", line 150, in callcatch
return func() File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 292, in
_runcatchfunc
return _dispatch(req) File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 896, in
_dispatch
cmdpats, cmdoptions) File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 658, in runcommand
ret = _runcommand(ui, options, cmd, d) File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 904, in
_runcommand
return cmdfunc() File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 893, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 1079, in check
return func(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/mercurial/extensions.py", line 322, in closure
return func(*(args + a), **kw) File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 1079, in check
return func(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/hgext/mq.py", line 3542, in mqcommand
return orig(ui, repo, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 1079, in check
return func(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/mercurial/commands.py", line 4034, in push
other = hg.peer(repo, opts, dest) File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 178, in peer
return _peerorrepo(rui, path, create).peer() File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 153, in
_peerorrepo
obj = _peerlookup(path).instance(ui, path, create) File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 391, in instance
inst._fetchcaps() File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 123, in
_fetchcaps
self.caps = set(self._call('capabilities').split()) File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 301, in
_call
fp = self._callstream(cmd, **args) File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 230, in
_callstream
resp = self.urlopener.open(req) File "/usr/lib/python2.7/urllib2.py", line 435, in open
response = meth(req, response) File "/usr/lib/python2.7/urllib2.py", line 548, in http_response
'http', request, response, code, msg, hdrs) File "/usr/lib/python2.7/urllib2.py", line 467, in error
result = self._call_chain(*args) File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
result = func(*args) File "/usr/lib/python2.7/urllib2.py", line 909, in http_error_401
url, req, headers) File "/usr/lib/python2.7/dist-packages/mercurial/url.py", line 405, in http_error_auth_reqed
self, auth_header, host, req, headers) File "/usr/lib/python2.7/urllib2.py", line 887, in http_error_auth_reqed
return self.retry_http_basic_auth(host, req, realm) File "/usr/lib/python2.7/dist-packages/mercurial/url.py", line 408, in retry_http_basic_auth
user, pw = self.passwd.find_user_password(realm, req.get_full_url()) File "/tmp/prompthooks2.py", line 208, in find_user_password
user, password = urllib2.HTTPPasswordMgrWithDefaultRealm.find_user_password(self, realm, authuri) TypeError: unbound method find_user_password() must be called with HTTPPasswordMgrWithDefaultRealm instance as first argument (got passwordmgr instance instead)
I have tried cloning the hg-prompt python script and adding the path to my ~/.hgrc as per https://bitbucket.org/sjl/hg-prompt/src
I still get the error:
$ hg prompt "test"
hg: unknown command 'prompt'
As an aside - I notice now that PhpStorm isn't prompting me for my hg repo password on push..
I also have tried disabling the extension in .hgrc
[extensions]
hgview = !
prompt = !
hg4ideapromptextension = !
still no luck
This was the response from Eugene Morozov (IntelliJ)
This is a bug that has already been fixed, but unfortunately the fix
won't be backported to v10.
https://youtrack.jetbrains.com/issue/IDEA-159546 Is there a chance you
could update?

exceptions.TypeError: __init__() got an unexpected keyword argument 'settings'

I have downloaded the distribute-crawler from github. But I found that didn't work. It is giving:
unexpected keyword argument 'settings'
Anybody know this?
The full stack trace is as follows:
2017-03-31 15:43:43 [twisted] ERROR: Unhandled error in Deferred:
2017-03-31 15:43:43 [twisted] ERROR: Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/scrapy/commands/crawl.py", line 57, in run
self.crawler_process.crawl(spname, **opts.spargs)
File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 163, in crawl
return self._crawl(crawler, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 167, in _crawl
d = crawler.crawl(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1237, in unwindGenerator
return _inlineCallbacks(None, gen, Deferred())
--- <exception caught here> ---
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1099, in _inlineCallbacks
result = g.send(result)
File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 90, in crawl
six.reraise(*exc_info)
File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 72, in crawl
self.engine = self._create_engine()
File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 97, in _create_engine
return ExecutionEngine(self, lambda _: self.stop())
File "/usr/local/lib/python2.7/dist-packages/scrapy/core/engine.py", line 70, in __init__
self.scraper = Scraper(crawler)
File "/usr/local/lib/python2.7/dist-packages/scrapy/core/scraper.py", line 71, in __init__
self.itemproc = itemproc_cls.from_crawler(crawler)
File "/usr/local/lib/python2.7/dist-packages/scrapy/middleware.py", line 58, in from_crawler
return cls.from_settings(crawler.settings, crawler)
File "/usr/local/lib/python2.7/dist-packages/scrapy/middleware.py", line 36, in from_settings
mw = mwcls.from_crawler(crawler)
File "/usr/local/lib/python2.7/dist-packages/scrapy/pipelines/media.py", line 51, in from_crawler
pipe = cls.from_settings(crawler.settings)
File "/usr/local/lib/python2.7/dist-packages/scrapy/pipelines/images.py", line 95, in from_settings
return cls(store_uri, settings=settings)
exceptions.TypeError: __init__() got an unexpected keyword argument 'settings'

test_database() does not use the database given

I'm trying to test my models using peewee's test_database which is supposed to use the database passed when executing the SQL in the context block. However running the test, I noticed that the production database is always used, which should not be the case.
Here's the exception I get:
======================================================================
ERROR: test_Admin (__main__.DatabaseTestSuite)
----------------------------------------------------------------------
Traceback (most recent call last):
File "db/db_test.py", line 14, in test_Admin
with test_database(test_db, (Admin), create_tables=True):
File "/usr/local/lib/python2.7/dist-packages/playhouse/test_utils.py", line 21, in __enter__
for m in self.models:
File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 4723, in __iter__
return iter(self.select())
File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 3149, in __iter__
return iter(self.execute())
File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 3142, in execute
self._qr = ResultWrapper(model_class, self._execute(), query_meta)
File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 2826, in _execute
return self.database.execute_sql(sql, params, self.require_commit)
File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 3683, in execute_sql
self.commit()
File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 3507, in __exit__
reraise(new_type, new_type(*exc_args), traceback)
File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 3676, in execute_sql
cursor.execute(sql, params or ())
File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 166, in execute
result = self._query(query)
File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 322, in _query
conn.query(q)
File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 835, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1019, in _read_query_result
result.read()
File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1302, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 981, in _read_packet
packet.check_error()
File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 393, in check_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python2.7/dist-packages/pymysql/err.py", line 107, in raise_mysql_exception
raise errorclass(errno, errval)
ProgrammingError: (1146, u"Table 'db.admin' doesn't exist")
----------------------------------------------------------------------
Here's the test code:
from db import *
import unittest
from playhouse.test_utils import test_database
test_db = MySQLDatabase('testdb',
user='testuser',
password='testpass')
class DatabaseTestSuite(unittest.TestCase):
def test_Admin(self):
with test_database(test_db, (Admin), create_tables=True):
Admin.create(username="testuser",
email="testuser#email.com")
result = Admin.select().where(Admin.user == "testuser")
unittest.assertIsNotNone(result)
if __name__ == '__main__':
unittest.main()
I've opened an issue on the github page, but received no help so far. You can find the issue here. It should provide extra details if needed. Any help would be appreciated, thanks.
The model tuple has a single item and thus requires a trailing comma. Changing this
with test_database(test_db, (Admin), create_tables=True):
to this
with test_database(test_db, (Admin,), create_tables=True):
resolved it.

python-selenium on aws lambda throws error when switch_back_to.default_content and try to select element

python-selenium using phantomjs used to open an iFrame inside the page, then after switching back to the default content(driver.switch_to.default_content()) does not work.
The following is a pseudo code snippet to explain the scenario.
frame = WebDriverWait(driver, wait_time).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR, "iframe.class_name")))
......
driver.switch_to.default_content()
print('Switched back to default content')
# Error occurs when line below is interpreted
driver.find_element_by_css_selector("div[title^='Test %s']" %(array_of_content[1]))
Following error occurs:-
Traceback (most recent call last):
File "/var/task/main.py", line 217, in test_method
driver.find_element_by_css_selector("div[title^='Test %s']" %(array_of_content[1]))
File "/var/task/selenium/webdriver/support/wait.py", line 71, in until
value = method(self._driver)
File "/var/task/selenium/webdriver/support/expected_conditions.py", line 213, in __call__
element = visibility_of_element_located(self.locator)(driver)
File "/var/task/selenium/webdriver/support/expected_conditions.py", line 78, in __call__
return _element_if_visible(_find_element(driver, self.locator))
File "/var/task/selenium/webdriver/support/expected_conditions.py", line 307, in _find_element
return driver.find_element(*by)
File "/var/task/selenium/webdriver/remote/webdriver.py", line 752, in find_element
'value': value})['value']
File "/var/task/selenium/webdriver/remote/webdriver.py", line 234, in execute
response = self.command_executor.execute(driver_command, params)
File "/var/task/selenium/webdriver/remote/remote_connection.py", line 401, in execute
return self._request(command_info[0], url, body=data)
File "/var/task/selenium/webdriver/remote/remote_connection.py", line 471, in _request
resp = opener.open(request, timeout=self._timeout)
File "/usr/lib64/python2.7/urllib2.py", line 431, in open
response = self._open(req, data)
File "/usr/lib64/python2.7/urllib2.py", line 449, in _open
'_open', req)
File "/usr/lib64/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/lib64/python2.7/urllib2.py", line 1229, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib64/python2.7/urllib2.py", line 1202, in do_open
r = h.getresponse(buffering=True)
File "/var/task/raven/breadcrumbs.py", line 328, in getresponse
rv = real_getresponse(self, *args, **kwargs)
File "/usr/lib64/python2.7/httplib.py", line 1132, in getresponse
response.begin()
File "/usr/lib64/python2.7/httplib.py", line 453, in begin
version, status, reason = self._read_status()
File "/usr/lib64/python2.7/httplib.py", line 417, in _read_status
raise BadStatusLine(line)
BadStatusLine: ''
Any ideas, what is happening.
As I am able to see the same error, even if I write driver.save_screenshot('test.png').
But it is not throwing any error on local machines, also tried to use AMI instance to replicate if something is there in concern Amazon Linux.

AttributeError: 'int' object has no attribute '_compiler_dispatch'

I am using the flask-sqlalchemy extension with alembic for migrations. When I try to add a new migration file and upgrade the schema to the latest one, I get the following error:
AttributeError: 'int' object has no attribute '_compiler_dispatch'
The content of the migration file:
revision = 'ec2c2d40eb1'
down_revision = '28dda873b826'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.alter_column(
'users',
'wiki_permission',
new_column_name='wiki_group',
nullable=False,
existing_nullable=False,
type_=sa.Integer(),
existing_type=sa.Integer(),
server_default=1,
existing_server_default=1 # Line of error - 27
)
def downgrade():
op.alter_column(
'users',
'wiki_group',
new_column_name='wiki_permission',
nullable=False,
existing_nullable=False,
type_=sa.Integer(),
existing_type=sa.Integer(),
server_default=1,
existing_server_default=1
)
Thanks for taking time to help me.
Edit:
The complete error message :
INFO [alembic.migration] Context impl MySQLImpl.
INFO [alembic.migration] Will assume non-transactional DDL.
INFO [alembic.migration] Running upgrade 28dda873b826 -> ec2c2d40eb1, users change column wiki_permission to wiki_group
Traceback (most recent call last):
File "/home/kevin/Code/python/flask/terminus/venv/bin/alembic", line 9, in <module>
load_entry_point('alembic==0.6.5', 'console_scripts', 'alembic')()
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/config.py", line 298, in main
CommandLine(prog=prog).main(argv=argv)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/config.py", line 293, in main
self.run_cmd(cfg, options)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/config.py", line 279, in run_cmd
**dict((k, getattr(options, k)) for k in kwarg)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/command.py", line 125, in upgrade
script.run_env()
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/script.py", line 203, in run_env
util.load_python_file(self.dir, 'env.py')
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/util.py", line 212, in load_python_file
module = load_module_py(module_id, path)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/compat.py", line 58, in load_module_py
mod = imp.load_source(module_id, path, fp)
File "alembic/env.py", line 77, in <module>
run_migrations_online()
File "alembic/env.py", line 70, in run_migrations_online
context.run_migrations()
File "<string>", line 7, in run_migrations
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/environment.py", line 688, in run_migrations
self.get_context().run_migrations(**kw)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/migration.py", line 258, in run_migrations
change(**kw)
File "alembic/versions/ec2c2d40eb1_users_change_column_wiki_permission_to_.py", line 27, in upgrade
existing_server_default=1,
File "<string>", line 7, in alter_column
File "<string>", line 1, in <lambda>
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/util.py", line 329, in go
return fn(*arg, **kw)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/operations.py", line 317, in alter_column
existing_autoincrement=existing_autoincrement
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/ddl/mysql.py", line 44, in alter_column
else existing_autoincrement
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/ddl/impl.py", line 76, in _exec
conn.execute(construct, *multiparams, **params)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 720, in execute
return meth(self, multiparams, params)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 67, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 768, in _execute_ddl
compiled = ddl.compile(dialect=dialect)
File "<string>", line 1, in <lambda>
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 468, in compile
return self._compiler(dialect, bind=bind, **kw)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 25, in _compiler
return dialect.ddl_compiler(dialect, self, **kw)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 197, in __init__
self.string = self.process(self.statement, **compile_kwargs)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 220, in process
return obj._compiler_dispatch(self, **kwargs)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/ext/compiler.py", line 410, in <lambda>
lambda *arg, **kw: existing(*arg, **kw))
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/ext/compiler.py", line 448, in __call__
return fn(element, compiler, **kw)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/ddl/mysql.py", line 171, in _mysql_change_column
autoincrement=element.autoincrement
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/ddl/mysql.py", line 190, in _mysql_colspec
spec += " DEFAULT %s" % _render_value(compiler, server_default)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/ddl/mysql.py", line 179, in _render_value
return compiler.sql_compiler.process(expr)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 220, in process
return obj._compiler_dispatch(self, **kwargs)
AttributeError: 'int' object has no attribute '_compiler_dispatch'
Alright, I just went through this same issue. I'm not using flask-sqlalchemy, just straight alembic, but it should be identical.
Second, it worked for me with sa.Integer with no parentheses, so I would recommend that.
The alembic docs say:
When producing MySQL-compatible migration files, it is recommended that the existing_type, existing_server_default, and existing_nullable parameters be present, if not being altered.
Since it seems you are not altering these columns, the docs suggest they should be present. So:
Remove nullable, type_, and server_default. They are not being altered.
Keep existing_nullable, existing_type, and existing_server_default.