I am struggling to render my PostgreSQL data in my flask app and I am not sure why. The GET route I am attempting to render all of the data with is returning an empty array, even though my data table has 16 records in it (I premade this…
I have a Flask website that uses the peewee ORM. The connection is managed by FlaskDB.
When I only use 1 gunicorn worker, it works well. But as soon as I use 2 or more gunicorn workers, I start getting this error:
Traceback (most recent call last):
…
I created a practice blog using Flask and Peewee. I wanted to include pagination in the app . I followed Colifier example blog pagination and it works fine. My question, is there a way for me show number of pages like this:
This is the example…
I am struggling with the following:
from my_db_definition import db
from peewee import *
class A(Model):
class Meta:
database=db
table_name = 'random'
class B(A):
pass
when…
I am using MySQL with Peewee. Everything has worked nicely, but now I can't order my query in a random order.
Based on the documentation I've tried the following code:
import peewee as pw
objz = featured.select().order_by(fn.Rand()).limit(5)
After…
I've written a flask-restful API, and a SQLite database with peewee. I am able to 'get' on my list of art pieces that I am storing data for. I am also able to 'get' single pieces, 'post', and 'put' without issue. However, if I want to delete a…
I have got this query in Peewee:
return c = Products.get(Products.sku == article).get()
How to check if it returns data?
I tried:
if c.count() > 0:
if len(c) > 0
It does not work for me
This is full code:
try:
r =…
Hello Stackoverflow Community,
I have just started working on peewee application and little stuck with join queries. Currently, I have following models setup :
class Equipment(BaseModel):
equip_id = CharField(primary_key=True)
is_fullset =…
I am trying to put data into a database using flask and peewee, and I have come across the following error: peewee.OperationalError: no such table: post
My models.py file is below:
from peewee import *
import datetime
db =…
I am writing a simple social media app using flask python framework and Sqlite as database. But after running the program, it shows the following error. I am kind of confused what is causing the bug.
peewee.OperationalError: Connection already…
I am using Peewee with Flask. I have a table of parts that I want to be able to add to, delete and update from a form. I have the add part working and am working on the delete function. This function will delete a row from the db that is equal to…
I'm using Flask and Peewee to create models for Users and Appointments, and each of them have a ForeignKeyField referencing each other. The problem is, if I define one above the other, Flask will give me x is not defined.
For example:
class…
Not able to set default timestamp in spite of using DateTimeField(default=datetime.datetime.now)
The column is set to not null but no default value is set
I have my model
import datetime
database =…
Two servers, different results. Same version of peewee, same version of mysql, same python (2.7.10)
code:
from peewee import *
import pprint
mysql_db = MySQLDatabase('my_database', user="root", password="")
class ItemType(Model):
id =…
I am working on expanding my flask skills and have worked on the treehouse flask social network project and got it to work. I am now playing with changing settings and allowing social login I have moved over to flask-security from plain bcrypt as it…