This is a Python import problem.

Asked 1 years ago, Updated 1 years ago, 110 views

Hello, I'm a newbie who just started Python.

Cannot import name "Module" from "flask" I installed the flask and checked that it was installed well. Can you tell me why not?ㅠ<

from flask import Module
from flask import redirect,request
from random import sample
from util import *

root = Module(__name__)

from db import Database

@root.route("/about/")
def load_about():
  votesCount = Database.getVotesCount()
  return auto_template('about.html', votes_contributed=votesCount)

@root.route("/vision/")
def load_vision():
  votesCount = Database.getVotesCount()
  return auto_template('vision.html', votes_contributed=votesCount)
The following is omitted.

Error message

Traceback (most recent call last): File "D:/fresh/Desktop/Research Folder/Place-Pulse/root.py", line 1, in from flask import Module

ImportError: cannot import name 'Module' from 'flask' (D:\fresh\Desktop\Research Folder\Python\venv\lib\site-packages\flask_init_.py)

python flask module

2022-09-20 22:26

1 Answers

from flask import Flask
...
#root = Module(__name__)
root = Flask(__name__)
...
if __name__== "__main__":
    root.run()


2022-09-20 22:26

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.