Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the problems encountered by flaskr

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

What are the problems encountered by flaskr? in view of this problem, this article introduces the corresponding analysis and solutions in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

1. Sqlite3.OperationalError: near "create": syntax errordrop table if exists entries;create table entries (id integer primary key autoincrement, title string not null, text string not null)

Reason: forget the semicolon after the first line entries

2. Flask Value error view function did not return a response [duplicate] @ app.route ('/ login', methods= ['GET') 'POST']) def login (): error = None if request.method = =' POST': if request.form ['username']! = app.config [' USERNAME']: error = 'Invalid username' elif request.form [' password']! = app.config ['PASSWORD']: error =' Invalid password' else: session ['logged_in'] = True flash ('You were logged in') return redirect (url_for (' show_entries')) return render_template ('login.html') Error=error)

Error: no function return value is shown; reason: return statement is written in the upper scope without paying attention to format

3. 'Flask' object has no attribute' app'def init_db (): with app.app.context (): db = get_db () with app.open_resource ('schema.sql', mode='r') as f: db.cursor () .executescript (f.read ()) db.commit ()

Reason: app.app_context () is written as app.app.context (), so it doesn't recognize app.

4. Mac comes with python 2.7, but I want to use the latest version of python, and the installation of pyhton3; with pip is not successful. The final implementation is as follows:

With the brewbrew terminal, execute brew uninstall python, r and then brew install python

Then execute python, and the version information of python3 is displayed.

Error: The file/path provided (flaskr) does not appear to exist. Please verify the path is correct. If app is not on PYTHONPATH, ensure the extension is .py

Problems encountered when doing flask-tutorial on the official website of flask

`export FLASK_APP=flaskr

Export FLASK_ENV=development

Flask run `

Solution: replace flask run with python-m flask run

This is the end of the answers to the questions encountered by flaskr. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report