View the main page when an error occurs

The application consists of only one page. Instead of error pages it should simple display the main site. How should I implement the error handles for that?You can do that with the help of error handlers i.e) @app.errorhandler(404) def page_not_found

Error installing uwsgi in virtualenv

I'm trying to install uswgi in a virutal env on linux ubuntu, python 3.5.2 I do pip install uwsgi I got this error Failed building wheel for uwsgi and at the end of the installing logs *** uWSGI compiling embedded plugins *** [thread 0][x86_64-linux-

Python / Flask - Using flask_restless with flask_httpauth

my objective in this question is to secure my API. in my application, I'm using Flask and flask_restless's APIManager to provide CRUD API to my Person object. code sample: manager = APIManager(app, flask_sqlalchemy_db=db) manager.create_api(Person, m

Error 405: unauthorized method flask, ajax

Just trying to submit the form data to the MySQL DB using Ajax & Python- Flask, but the same error "method not allowed" appearing again and again.. kindly look at the codes and help me out... <div class="modal-content"> <d

Scripts in Python in the current directory

So, I'm in a bit of a particular situation and i'm trying to find a clean solution. Currently we've got 18 different repos, all with python deployment utilities copy and pasted 18 times with venv... to me this is disgusting. I'd like to bake those ut

How to use count () in Flask-sqlalchemy

I am assisting a project which uses flask-sqlalchemy.I want a db query to count the number of records in the table.Can I use table.query.filter_by(condition).count() directly or is there anything that I need to add.Please assist me.I am a begineer.Th

How can I tell if I can disable SQLALCHEMY_TRACK_MODIFICATIONS?

Every time I run my app that uses Flask-SQLAlchemy I get the following warning that the SQLALCHEMY_TRACK_MODIFICATIONS option will be disabled. /home/david/.virtualenvs/flask-sqlalchemy/lib/python3.5/site-packages/flask_sqlalchemy/ Us

Share sqlalchemy templates between flask and other apps

I have a running Flask application that is set up according to a combination of best practices we found online and in Miguel Grinberg's "Flask Web Development" book. We now need a second Python application, that is NOT a web app, and that needs

No hash password in Flask

I don't know why the password is not hashing using Bcrypt. I think I am doing it right. I initilized Bcrypt correctly and I am using mongoengine. Everytime I look at the database it still shows the unencrypyed passwrod in text. users/ from a

The use of python multiprocessing allows to hang the gunicorn

First I will admit that there are a few to many keywords in that title, but I am indeed really trying to capture the problem in the correct manner. The issue here is that I can not seem to be able to correctly create a sub process using the python mu

Detect if the balloon is running via gunicorn?

Is there a way I can check if my flask app is being run instide a gunicorn container? Currently I set an enviroment variable to tell my application this, but I'd prefer that it be automatic. Additionally, is there someway I can check what worker clas

flask-admin sets the required attribute on the relationship

flask-admin marks db.relationship fields of model views as required, so there is no way to add a record if the table to which relationship goes is empty. Example: class Type(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.

Flask 405 Method Error

Hi i'm trying to add a contact to my sqlite db although I keep getting a 405 method error. Any ideas?? my method: @app.route('/addcontact/', methods=['POST']) def contact_add(): if request.method == 'POST': g.db.execute('insert into address (surname,

Flask-SQLAlchemy number of results in the query

I was wondering if anyone knows how to output the number of results from a query in a flask template. Example view code: products = Product.query.all() In the template it would be handy to be able to just do: {{ products.count() }} Is there anyway to

Flask: How to make the line break in the template?

I have a simple form like this: class RecordForm(Form): notes = TextAreaField('Notes') I record the data in three paragraphs like this: para1 para2 para3 In the template I would like to see the content of that record in read-only. (Not editable form)

bottle-sqlalchemy or sqlalchemy

I am new in both flask and sqlalchemy, I just start working on a flask app, and I am using sqlalchemy for now. I was wondering if there is any significant benefit I can get from using flask-sqlalchemy vs sqlalchemy. I could not find enough motivation

Using Flask-Babel with virtualenv fails

I have Flask, Babel and Flask-Babel installed in the global packages. When running python and I type this, no error >>> from flaskext.babel import Babel >>> With a virtual environment, starting python and typing the same command I see &g

How to set a default value for a WTForms SelectField?

When attempting to set the default value of a SelectField with WTForms, I pass in value to the 'default' parameter like so. class TestForm(Form): test_field = SelectField("Test: ", choices=[(1, "Abc"), (2, "Def")], default=2)

Why am I receiving an ExtraValueException from mongoalchemy?

Here is my class: class Presentation(db.Document): title = db.StringField(max_length=120, required=True) author = db.StringField (required=True) pages = db.DocumentField(Page, required=False) tags = db.StringField(max_length=120, required=False) id =