How do i fix this flask sqlalchemy problem? [closed] - python

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 13 hours ago.
Improve this question
So basically, im trying to make a website using flask, however, when i type: from flask import SQLAlchemy, it gives me this error message:
File "C:\Users\PycharmProjects\pythonProject4\website_init_.py",
line 2, in
from flask import sqlalchemy ImportError: cannot import name 'SQLAlchemy' from 'flask'
(C:\Users\PycharmProjects\pythonProject4\venv\Lib\site-packages\flask_init_.py)
Anyone know how to solve it?

The correct way to import SQLAlchemy is
from flask_sqlalchemy import SQLAlchemy
source

Related

cannot import name 'reder_template' from 'flask' [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 months ago.
Improve this question
How to fix this error :
cannot import name 'reder_template' from 'flask' (/usr/local/lib/python3.9/site-packages/flask/init.py)
from flask import Flask, request, reder_template, redirect
import os
import sqlite3
currentlocation = os.path.dirname(os.path.abspath(__file__))
myapp = Flask(__name__)
#myapp.route("/")
def homepage():
return render_template("homepage.html")
The problem is a typo, you have imported reder_template instead of render_template from flask.

Import Error when importing ValueError Exception [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I was trying this
from exceptions import ValueError
but got an error
ModuleNotFoundError: No module named 'exceptions'
any solutions??
You don't need to import ValueError. It's a built-in so you can always raise ValueError().
You do not need to import Exceptions. You can just use them as such
raise ValueError(text)

AttributeError: module 'random' has no attribute 'randit' [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I have seen the answers/recommendations for this questions.
I promise that I do not have a random.py file named on my computer. I have searched it, tried to delete it will the send2trash module as well as os.unlink. I simply do not get it. I am unable to call the random.randit() because of this issue. Also when I call os.cwd() the file path does not exist on my computer. I again, have no idea how this is possible.
The code would be random.randint(), not random.randit()

ImportError: cannot import name 'HttpResponce' from 'django.http' [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
So, I'm trying to create a web, and I use django. My code is next:
from django.http import HttpResponce
def index(request):
return HttpResponce('Hello World!!!')
I don't understand why it workes in another projects and doesn't work now.
You misspelled response as responce

How to resolve Import Error? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I did this :
import calender
But gives me this error :
ImportError: No module named calender
What should I do?
You have a typo in the name, it's calendar, not calender:
import calendar

Categories

Resources