Arrr. Spoke too soon! Running ./migrate.py is throwing up the following. I'm embarrassing myself here.
Database connection error? Any ideas @E-werd?
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 "./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")
(app) app@DESKTOP-K7K63GA:~/throat/scripts$
Arrr. Spoke too soon! Running ./migrate.py is throwing up the following. I'm embarrassing myself here.
Database connection error? Any ideas @E-werd?
```
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 "./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")
(app) app@DESKTOP-K7K63GA:~/throat/scripts$
```
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
....
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
....
```
So what you're running into now is a dated form of the guide. The file
install.py
has been replaced withmigrate.py
and can be used in the same way. This also gets used later on if and when the structure of the database changes. You'll know to use it if you see errors relating to missing fields.Here's the most up-to-date guide I have specifically for mysql/mariadb. Note that I've started using Alpine Linux now as that will ultimately be what I use if/when I finally get around to learning Docker as it's a tried-and-true linux distribution for this purpose. https://pastebin.com/Pdqh2Ji9
Also, if you're interested in using MySQL/MariaDB, Postgresql, or SQLite, then you might want to look at this link. We recently moved to Postgresql for the live site for performance and data integrity reasons, and while we were at it we made sure SQLite was working as well. SQLite is actually a great way to get a quick test or development instance running without configuring a database. https://pastebin.com/zFfLuMV6