from flask import Flask,render_template,flash,redirect,url_for,session,logging,request
from flask_mysqldb import MySQL
from wtforms import Form,StringField,TextAreaField,PasswordField,validators
from passlib.hash import sha256_crypt
app = Flask(__name__)
@app.route("/")
def index():
return render_template("index.html")
@app.route("/about")
def about():
return render_template("about.html")
I use Python 3.7.3 version. I installed flask-mysqldb.This code doesn't work and program give ModuleNotFoundError: No module named 'flask_mysqldb' Error in Vs.Code but this code work in Pycharm. Pycharm's Pyton interpreter is the same with Vs.Code's. How can I solve this problem ?
You need to config the env
path to the VS Code.
List of environments VS Code found.
Usually, VS Code can get env from /usr/bin/
directory and from env/
directory inside your working folder.
You can create a python environment by using python3 -m venv env
command
Select environment by clicking this inside the bottom bar( this is only appear when you open *.py
file.