An open API service indexing awesome lists of open source software.

https://github.com/transcental/toxicity-server

Backend for my toxicity-checker
https://github.com/transcental/toxicity-server

Last synced: 6 months ago
JSON representation

Backend for my toxicity-checker

Awesome Lists containing this project

README

          

Flask is a minimal Python framework that helps you create a web server.

Let's take a look at the code we have:

```python
from flask import Flask

app = Flask(__name__)

@app.route("/")
def hello_world():
return "

Hello, World!

"
```

What did that code do?

First we `import` the `Flask` class. An instance of this class will be our WSGI application.

Next we create an instance of this class. The first argument is the name of the application’s module or package. `__name__` is a convenient shortcut for this that is appropriate for most cases. This is needed so that Flask knows where to look for resources such as templates and static files.

We then use the `route()` decorator to tell Flask what URL should trigger our function. In this case we use `/` routh, which is the default route of any website.

The function returns the message we want to display in the user’s browser. The default content type is HTML, so HTML in the string will be rendered by the browser.

To learn more, checkout the [official guide](https://flask.palletsprojects.com/en/2.0.x/quickstart/).