yangyuexiong / flask_bestpractices Goto Github PK
View Code? Open in Web Editor NEWFlask最佳实践
License: Mozilla Public License 2.0
Flask最佳实践
License: Mozilla Public License 2.0
Hi, I am new to the Flask. I have followed your guide in ReadMe that set the virtual env and env variable "FLASK_ENV" and "STARTUP_MODE". Then I run the run.py (masOS).
the terminal returns:
`时间:2020-06-10 23:32:47.230466
操作系统:Darwin
项目路径:/Flask_BestPractices
当前环境:development
启动方式:pyc
threading: 4623654336
当前进程id: 22563
父进程id: 17994
< ------------------------------------------------------------------ >
When I click http://0.0.0.0:9999/ , the webset returns:
'
{
"code": 404,
"data": "GET /",
"message": "HTTPException:\u3010404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.\u3011"
}
'
I do not know what is my wrong? I would also like to know the meaning of the value "pyc" and "ter" for Variable "STARTUP_MODE".
Thank you !
Only if not already done somewhere I missed, with a little refactor it looks like this:
def api_result(code=None, message=None, data=None, details=None, status=None):
result = {
'code': code,
'message': message,
'data': data,
'details': details,
'status': status
}
if not result['data']:
result.pop('data')
if not result['details']:
result.pop('details')
if not result['status']:
result.pop('status')
return jsonify(result)
def webhook_result(code=None, message=None, data=None, status=None, details=None):
return api_result(
code=code, message=message, data=data, details=details, status=status
), code
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.