这是indexloc提供的服务,不要输入任何密码
Skip to content

anynamefordeletingthis/hello-flask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hello FLask

content

set variables

set FLASK_APP=hello
set FLASK_ENV=development 

This will run hello.py file as app, by default it runs app.py, there are two environments, development and production.

run

python -m flask run

-p for port

using HTML templates

Flask uses jinja template engine.

How to create a virtual environment

install virtualenv

pip install virtualenv

create a virtual environment

python3 -m venv venv

activate virtual environment

venv\Scripts\activate

then install required libraries(eg flask) and create a package file.

pip freeze > requirements.txt

Deploy to vercel

  1. create a vercel.json file with following content
{
    "version": 2,
    "builds": [{
        "src": "./hello.py",
        "use": "@vercel/python"
    }],
    "routes": [{
        "src": "/(.*)",
        "dest": "/hello.py"
    }]
}
  1. then install required libraries(eg flask) and create a package file.

  2. create requirements.txt file pip freeze > requirements.txt

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published