This is how the config.py file looks like (truncated the bottom parts of the file)
What I have done is use the following format as was in the config.py file.
DATABASE_URL = 'mysql://**debian-sys-maint**:**5oCNi3MRmSXRxJFI**@localhost/throat'
DBUSER in this case is debian-sys-maint
PASSWORD is 5oCNi3MRmSXRxJFI
Not sure if I'm doing this right. Since the config.py is the latest version, thought of keeping it this way to connect to the database (based on the example.config.py file).
My config.py file btw.
""" This is the config file. Pretty obvious, right? """
import os
# Site title
LEMA = "Throat: Open discussion ;D"
# Copyright notice, used in the footer
COPY = "2016 Throat. All Rights Reserved."
# Database connection information
DATABASE_URL = 'mysql://debian-sys-maint:5oCNi3MRmSXRxJFI@localhost/throat'
# Method used to memoize stuff. Change to 'redis' if you use Redis
CACHE_TYPE = 'simple'
# Only used if CACHE_TYPE is 'redis'.
CACHE_REDIS_HOST = '127.0.0.1'
CACHE_REDIS_PORT = 6379
CACHE_REDIS_DB = 5
....
OK, it's your DATABASE_URL
line. That was changed when we started supporting multiple database types. The new format, given your information...
DATABASE = {
'host': 'localhost',
'name': 'throat',
'engine': 'MySQLDatabase',
'user': 'debian-sys-maint',
'password': '5oCNi3MRmSXRxJFI',
}
EDIT: See this guide that covers all the database types: https://pastebin.com/zFfLuMV6
The options for "engine" are: PostgresqlDatabase, MySQLDatabase, SqliteDatabase
I'm mostly putting this info here in case anybody looks in a search engine, it's outside of your scope.
Thanks you for being so helpful and elaborate @E-werd. Please answer at your leisure time as I've taking too much of your time.
Here's how my complete config.py file looks now.
""" This is the config file. Pretty obvious, right? """
import os
# Site title
LEMA = "Throat: Open discussion ;D"
# Copyright notice, used in the footer
COPY = "2016 Throat. All Rights Reserved."
##
## Database connection configuration
##
DATABASE = {
'host': 'localhost',
'name': 'throat',
'engine': 'MySQLDatabase',
'user': 'debian-sys-maint',
'password': '5oCNi3MRmSXRxJFI',
}
# Method used to memoize stuff. Change to 'redis' if you use Redis
CACHE_TYPE = 'simple'
# Only used if CACHE_TYPE is 'redis'.
CACHE_REDIS_HOST = '127.0.0.1'
CACHE_REDIS_PORT = 6379
CACHE_REDIS_DB = 5
# The Redis that we use for SocketIO. This must be the same for all instances
SOCKETIO_REDIS_URL = 'redis://127.0.0.1:6379/1'
# Secret key used to encrypt session cookies. CHANGE THIS
SECRET_KEY = 'yS\x1c\x88\xd7\xb5\xb0\xdc\t:kO\r\xf0D{"Y\x1f\xbc^\xad'
# wtforms settings. Set to False to disable CSRF
WTF_CSRF_ENABLED = True
WTF_CSRF_SECRET_KEY = SECRET_KEY
# Sengrid API key, only used to send password recovery emails
SENDGRID_API_KEY = "put it here"
SENDGRID_DEFAULT_FROM = "[email protected]"
# This is the path thumbnails will be stored on
THUMBNAILS = "./thumbs"
# This is the domain where the thumbnails are hosted on. Can be an absolute path too.
THUMBNAIL_HOST = "https://foo.bar/"
# THUMBNAIL_HOST = "/static/thumbnails"
# Same as above but for file storage (Used for user and sub file uploads)
STORAGE = "./stor"
STORAGE_HOST = "https://i.foo.bar/"
# SID of changelog sub (used to display last changelog entry on the sidebar)
# Leave empty to disable changelogs
CHANGELOG_SUB = ''
# Only for debugging and testing. Disable both in production
DEBUG = True
TESTING = True # This makes all the captchas valid
# Max content-length accepted by the server
MAX_CONTENT_LENGTH = (1024 * 1024) * 10 # 10MB limit
# Prefix for subs. Must always start with /.
SUB_PREFIX = "/s"
I've also removed the following line.
DATABASE_URL = 'mysql://debian-sys-maint:5oCNi3MRmSXRxJFI@localhost/throat'
Next, I run the following.
app@DESKTOP-K7K63GA:~/throat$ scripts/migrate.py
But again the following error is produced.
Starting migrations
Migrate "001_initial"
Migration failed: 001_initial
Traceback (most recent call last):
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee.py", line 2949, in execute_sql
cursor.execute(sql, params or ())
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/MySQLdb/cursors.py", line 206, in execute
res = self._query(query)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/MySQLdb/cursors.py", line 312, in _query
db.query(q)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/MySQLdb/connections.py", line 224, in query
_mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (1101, "BLOB, TEXT, GEOMETRY or JSON column 'sidebar' can't have a default value")
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee_migrate/router.py", line 154, in run_one
migrator.run()
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee_migrate/migrator.py", line 131, in run
op()
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee.py", line 6296, in create_table
cls._schema.create_all(safe, **options)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee.py", line 5456, in create_all
self.create_table(safe, **table_options)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee.py", line 5311, in create_table
self.database.execute(self._create_table(safe=safe, **options))
File "./app/models.py", line 64, in peewee_count_queries
return dex(*args, **kwargs)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee.py", line 2962, in execute
return self.execute_sql(sql, params, commit=commit)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee.py", line 2956, in execute_sql
self.commit()
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee.py", line 2732, in __exit__
reraise(new_type, new_type(*exc_args), traceback)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee.py", line 183, in reraise
raise value.with_traceback(tb)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee.py", line 2949, in execute_sql
cursor.execute(sql, params or ())
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/MySQLdb/cursors.py", line 206, in execute
res = self._query(query)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/MySQLdb/cursors.py", line 312, in _query
db.query(q)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/MySQLdb/connections.py", line 224, in query
_mysql.connection.query(self, query)
peewee.OperationalError: (1101, "BLOB, TEXT, GEOMETRY or JSON column 'sidebar' can't have a default value")
Traceback (most recent call last):
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee.py", line 2949, in execute_sql
cursor.execute(sql, params or ())
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/MySQLdb/cursors.py", line 206, in execute
res = self._query(query)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/MySQLdb/cursors.py", line 312, in _query
db.query(q)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/MySQLdb/connections.py", line 224, in query
_mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (1101, "BLOB, TEXT, GEOMETRY or JSON column 'sidebar' can't have a default value")
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "scripts/migrate.py", line 25, in <module>
router.run()
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee_migrate/router.py", line 182, in run
self.run_one(mname, migrator, fake=fake, force=fake)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee_migrate/router.py", line 154, in run_one
migrator.run()
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee_migrate/migrator.py", line 131, in run
op()
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee.py", line 6296, in create_table
cls._schema.create_all(safe, **options)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee.py", line 5456, in create_all
self.create_table(safe, **table_options)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee.py", line 5311, in create_table
self.database.execute(self._create_table(safe=safe, **options))
File "./app/models.py", line 64, in peewee_count_queries
return dex(*args, **kwargs)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee.py", line 2962, in execute
return self.execute_sql(sql, params, commit=commit)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee.py", line 2956, in execute_sql
self.commit()
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee.py", line 2732, in __exit__
reraise(new_type, new_type(*exc_args), traceback)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee.py", line 183, in reraise
raise value.with_traceback(tb)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/peewee.py", line 2949, in execute_sql
cursor.execute(sql, params or ())
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/MySQLdb/cursors.py", line 206, in execute
res = self._query(query)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/MySQLdb/cursors.py", line 312, in _query
db.query(q)
File "/home/app/.pyenv/versions/app/lib/python3.5/site-packages/MySQLdb/connections.py", line 224, in query
_mysql.connection.query(self, query)
peewee.OperationalError: (1101, "BLOB, TEXT, GEOMETRY or JSON column 'sidebar' can't have a default value")
Check on your
config.py
settings. Reference one of the newer guides to see how it should be.