techwithtim / flask-web-app-tutorial Goto Github PK
View Code? Open in Web Editor NEWCode for the note storing flask web app made during a YouTube video.
Code for the note storing flask web app made during a YouTube video.
In models.py, when I run from . import db, I get the error ImportError: attempted relative import with no known parent package.
Both init.py and models.py are inside the folder website. I can't find the solution anywhere, I've tried several things but none work.
Please help!
C:\Users\CBAS\AppData\Local\Programs\Python\Python37\lib\site-packages\flask_sqlalchemy_init_.py:834: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True or False to suppress this warning.
'SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and '
Traceback (most recent call last):
File "C:/Users/CBAS/Documents/Python Scripts/Pycharm/Tech with Tim/main.py", line 9, in app = create_app()
File "C:\Users\CBAS\Documents\Python Scripts\Pycharm\Tech with Tim\website_init_.py", line 27, in create_app create_database(app)
File "C:\Users\CBAS\Documents\Python Scripts\Pycharm\Tech with Tim\website_init_.py", line 38, in create_database
db.create_all(app=app)
File "C:\Users\CBAS\AppData\Local\Programs\Python\Python37\lib\site-packages\flask_sqlalchemy_init_.py", line 1039, in create_all
self.execute_for_all_tables(app, bind, 'create_all')
File "C:\Users\CBAS\AppData\Local\Programs\Python\Python37\lib\site-packages\flask_sqlalchemy_init.py", line 1031, in execute_for_all_tables
op(bind=self.get_engine(app, bind), **extra)
File "C:\Users\CBAS\AppData\Local\Programs\Python\Python37\lib\site-packages\flask_sqlalchemy_init.py", line 962, in get_engine
return connector.get_engine()
File "C:\Users\CBAS\AppData\Local\Programs\Python\Python37\lib\site-packages\flask_sqlalchemy_init_.py", line 555, in get_engine
options = self.get_options(sa_url, echo)
File "C:\Users\CBAS\AppData\Local\Programs\Python\Python37\lib\site-packages\flask_sqlalchemy_init_.py", line 570, in get_options
self._sa.apply_driver_hacks(self.app, sa_url, options)
File "C:\Users\CBAS\AppData\Local\Programs\Python\Python37\lib\site-packages\flask_sqlalchemy_init.py", line 914, in apply_driver_hacks
sa_url.database = os.path.join(app.root_path, sa_url.database)
AttributeError: can't set attribute
I'm on 1:43.
When i start the server and submitted the signup form' i got AttributeError: 'scoped_session' object has no attribute 'commmit' exception.
It's on the auth.py file, "db.session.commmit()" is the specific line
i have no idea why.
Did you ever got it?
Hi Tim
Thank you for the great tutorial
I am following the video and currently at 1:43:05.
unfortunately I have an issue with the sigh-up option. i get this error message:
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: user
I made sure to import db as shown in the video and I don't know what else can be the problem.
do you have any idea?
this is my code so far:
sqlalchemy.exc.StatementError: (builtins.TypeError) SQLite DateTime type only accepts Python datetime and date objects as input.
i got this error about my DateTime function was not working
This is my code use it :
data = db.Column(db.DateTime(timezone=True), default=func.now())
Can anyone fix this ? I tried use from datetime import datetime
but it didn't work.
jinja2.exceptions.TemplateNotFound
jinja2.exceptions.TemplateNotFound: login.html
Traceback (most recent call last)
File "C:\Users\Yuvan\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\app.py", line 2091, in call
return self.wsgi_app(environ, start_response)
File "C:\Users\Yuvan\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\app.py", line 2076, in wsgi_app
response = self.handle_exception(e)
File "C:\Users\Yuvan\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\Yuvan\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\Yuvan\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\Yuvan\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "C:\Users\Yuvan\Desktop\Programing\1. Project\website\auth.py", line 28, in login
return render_template("login.html", user=current_user)
File "C:\Users\Yuvan\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\templating.py", line 148, in render_template
ctx.app.jinja_env.get_or_select_template(template_name_or_list),
File "C:\Users\Yuvan\AppData\Local\Programs\Python\Python310\Lib\site-packages\jinja2\environment.py", line 1068, in get_or_select_template
return self.get_template(template_name_or_list, parent, globals)
File "C:\Users\Yuvan\AppData\Local\Programs\Python\Python310\Lib\site-packages\jinja2\environment.py", line 997, in get_template
return self._load_template(name, globals)
File "C:\Users\Yuvan\AppData\Local\Programs\Python\Python310\Lib\site-packages\jinja2\environment.py", line 958, in _load_template
template = self.loader.load(self, name, self.make_globals(globals))
File "C:\Users\Yuvan\AppData\Local\Programs\Python\Python310\Lib\site-packages\jinja2\loaders.py", line 125, in load
source, filename, uptodate = self.get_source(environment, name)
File "C:\Users\Yuvan\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\templating.py", line 59, in get_source
return self._get_source_fast(environment, template)
File "C:\Users\Yuvan\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\templating.py", line 95, in _get_source_fast
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: login.html
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.
You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:
dump() shows all variables in the frame
dump(obj) dumps all that's known about the object
I keep getting this error: ( can't find 'main')
Anyone know why ?
this is in the main.py file
it says that it cant find that module
Traceback (most recent call last):
File "D:\python\Lib\site-packages\flask\app.py", line 2091, in call
return self.wsgi_app(environ, start_response)
File "D:\python\Lib\site-packages\flask\app.py", line 2076, in wsgi_app
response = self.handle_exception(e)
File "D:\python\Lib\site-packages\flask\app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "D:\python\Lib\site-packages\flask\app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "D:\python\Lib\site-packages\flask\app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "D:\python\Lib\site-packages\flask\app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "C:\Users\mineo\Desktop\flask\website\auth.py", line 19, in login
if check_password_hash(user.password, password):
File "D:\python\Lib\site-packages\werkzeug\security.py", line 219, in check_password_hash
return hmac.compare_digest(_hash_internal(method, salt, password)[0], hashval)
File "D:\python\Lib\site-packages\werkzeug\security.py", line 148, in _hash_internal
password = password.encode("utf-8")
AttributeError: 'NoneType' object has no attribute 'encode'
Error should be in this line:
user = User.query.filter_by(email=email).first()
if user:
if check_password_hash(user.password, password):
EDIT: Fixed by changing from
password = request.form.get('password')
#To:
password = request.form.get('password1')
Hi all,
I'm at the ~14 min mark of the video and trying to run the main.py script which doesnt work.
Someone else claimed the same issue and closed it without further hints. I would be glad to receive some pointers.
Cheers
When I am trying to log in or just hit enter with the email bar filled in, I get redirected to a faulty page with this is as the error, but I cannot figure out what exactly is going with the encoding.
File "C:\Users\Reece\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\app.py", line 2091, in call
return self.wsgi_app(environ, start_response)Open an interactive python shell in this frame
File "C:\Users\Reece\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\app.py", line 2076, in wsgi_app
response = self.handle_exception(e)
File "C:\Users\Reece\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\Reece\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\Reece\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\Reece\AppData\Local\Programs\Python\Python310\Lib\site-packages\flask\app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "C:\Users\Reece\OneDrive\Desktop\Flask Lesson\website\auth.py", line 19, in login
if check_password_hash(user.password, password):
File "C:\Users\Reece\AppData\Local\Programs\Python\Python310\Lib\site-packages\werkzeug\security.py", line 219, in check_password_hash
return hmac.compare_digest(_hash_internal(method, salt, password)[0], hashval)
File "C:\Users\Reece\AppData\Local\Programs\Python\Python310\Lib\site-packages\werkzeug\security.py", line 148, in _hash_internal
password = password.encode("utf-8")
AttributeError: 'NoneType' object has no attribute 'encode'
I am not sure if .password is not importing properly or if it is something I have to update or install using py3.10.2
I was following through the youtube guide and ran into an sqlalchemy operational error: no such column: user password
I tried copying the exact code from the github and i still got the error.
Here is the error:
sqlalchemy.exc.OperationalError
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: user.password
[SQL: SELECT user.id AS user_id, user.email AS user_email, user.password AS user_password, user.first_name AS user_first_name
FROM user
WHERE user.email = ?
LIMIT ? OFFSET ?]
[parameters: ('[email protected]', 1, 0)]
(Background on this error at: http://sqlalche.me/e/14/e3q8)
Traceback (most recent call last)
File "C:\Users\Lee Hyunjin\AppData\Local\Programs\Python\Python39\Lib\site-packages\sqlalchemy\engine\base.py", line 1770, in _execute_context
self.dialect.do_execute(
File "C:\Users\Lee Hyunjin\AppData\Local\Programs\Python\Python39\Lib\site-packages\sqlalchemy\engine\default.py", line 717, in do_execute
cursor.execute(statement, parameters)
The above exception was the direct cause of the following exception:
File "C:\Users\Lee Hyunjin\AppData\Local\Programs\Python\Python39\Lib\site-packages\flask\app.py", line 2088, in call
return self.wsgi_app(environ, start_response)
File "C:\Users\Lee Hyunjin\AppData\Local\Programs\Python\Python39\Lib\site-packages\flask\app.py", line 2073, in wsgi_app
response = self.handle_exception(e)
File "C:\Users\Lee Hyunjin\AppData\Local\Programs\Python\Python39\Lib\site-packages\flask\app.py", line 2070, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\Lee Hyunjin\AppData\Local\Programs\Python\Python39\Lib\site-packages\flask\app.py", line 1515, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\Lee Hyunjin\AppData\Local\Programs\Python\Python39\Lib\site-packages\flask\app.py", line 1513, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\Lee Hyunjin\AppData\Local\Programs\Python\Python39\Lib\site-packages\flask\app.py", line 1499, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "C:\Codes\Project\website\auth.py", line 46, in sign_up
user = User.query.filter_by(email=email).first()
File "C:\Users\Lee Hyunjin\AppData\Local\Programs\Python\Python39\Lib\site-packages\sqlalchemy\orm\query.py", line 2760, in first
return self.limit(1)._iter().first()
File "C:\Users\Lee Hyunjin\AppData\Local\Programs\Python\Python39\Lib\site-packages\sqlalchemy\orm\query.py", line 2844, in _iter
result = self.session.execute(
File "C:\Users\Lee Hyunjin\AppData\Local\Programs\Python\Python39\Lib\site-packages\sqlalchemy\orm\session.py", line 1689, in execute
result = conn._execute_20(statement, params or {}, execution_options)
File "C:\Users\Lee Hyunjin\AppData\Local\Programs\Python\Python39\Lib\site-packages\sqlalchemy\engine\base.py", line 1582, in _execute_20
return meth(self, args_10style, kwargs_10style, execution_options)
File "C:\Users\Lee Hyunjin\AppData\Local\Programs\Python\Python39\Lib\site-packages\sqlalchemy\sql\elements.py", line 323, in _execute_on_connection
return connection._execute_clauseelement(
File "C:\Users\Lee Hyunjin\AppData\Local\Programs\Python\Python39\Lib\site-packages\sqlalchemy\engine\base.py", line 1451, in _execute_clauseelement
ret = self._execute_context(
File "C:\Users\Lee Hyunjin\AppData\Local\Programs\Python\Python39\Lib\site-packages\sqlalchemy\engine\base.py", line 1813, in _execute_context
self.handle_dbapi_exception(
File "C:\Users\Lee Hyunjin\AppData\Local\Programs\Python\Python39\Lib\site-packages\sqlalchemy\engine\base.py", line 1994, in handle_dbapi_exception
util.raise(
File "C:\Users\Lee Hyunjin\AppData\Local\Programs\Python\Python39\Lib\site-packages\sqlalchemy\util\compat.py", line 207, in raise
raise exception
File "C:\Users\Lee Hyunjin\AppData\Local\Programs\Python\Python39\Lib\site-packages\sqlalchemy\engine\base.py", line 1770, in _execute_context
self.dialect.do_execute(
File "C:\Users\Lee Hyunjin\AppData\Local\Programs\Python\Python39\Lib\site-packages\sqlalchemy\engine\default.py", line 717, in do_execute
cursor.execute(statement, parameters)
User.query.all()
Traceback (most recent call last):
File "C:\Python\Python37\lib\site-packages\sqlalchemy\util_collections.py", line 1020, in call
return self.registry[key]
KeyError: 9556
Not sure what do now couldnt resolve th issue anyone has any ideas or ran into the same problem as id did?
sqlalchemy.exc.OperationalError
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: user.first_name
[SQL: SELECT user.id AS user_id, user.email AS user_email, user.password AS user_password, user.first_name AS user_first_name
FROM user
WHERE user.email = ?
LIMIT ? OFFSET ?]
[parameters: ('[email protected]', 1, 0)]
(Background on this error at: http://sqlalche.me/e/13/e3q8)
Traceback (most recent call last)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
self.dialect.do_execute(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 609, in do_execute
cursor.execute(statement, parameters)
So i try to following what Tim do, so far its fine until try to create database, when the code running, the error shows like this :
UserWarning: Neither SQLALCHEMY_DATABASE_URI nor SQLALCHEMY_BINDS is set. Defaulting SQLALCHEMY_DATABASE_URI to "sqlite:///:memory:".
warnings.warn(
FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future.
Here the code , same as Tim :
is there anything that im missing ?
When I try to create a user (i.e Sign-up), the user credentials gets stored in the database, but after I submit I get this attribute error.
The error traces back to this line
login_user(user, remember=True)
in auth.py file under the @auth.route('/sign-up', methods=['GET', 'POST'])
route
Once I refresh and log in with the new credentials, I get logged in. The error persists after every new user creation, but the user details get stored in the DB. Where am I going wrong?
Also, once I login I cant redirect to the home page. I've to manually click on it.
flash('Logged in successfully', category='success')
login_user(user, remember=True)
redirect(url_for('views.home'))
When I am trying to log in or just hit enter with the email bar filled in, I get redirected to a faulty page with this is as the error, but I cannot figure out what exactly is going with the encoding.
if check_password_hash(user.password, password):
File "C:\Users\kdboa\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\werkzeug\security.py", line 219, in check_password_hash
return hmac.compare_digest(_hash_internal(method, salt, password)[0], hashval)
File "C:\Users\kdboa\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\werkzeug\security.py", line 148, in _hash_internal
password = password.encode("utf-8")
AttributeError: 'NoneType' object has no attribute 'encode'
These are the last three lines that look helpful to try and figure out what is going on.
Good afternoon,
I seem to be having an issue with my code when it comes to overwriting the python portion in the authentication.py doc
"AssertionError: View function mapping is overwriting an existing endpoint function: auth.login"
I have retyped the code in anywhich way I could and followed exactly what you have said. I am at a lost for what it could be
Please make the name of cities of lieferservice pages to small letters . Because I have indexed with small letters and now it is creating problems . So please change the url of lieferservice pages to small letters . I have also attached the file . Please see and make changes in name of cities by making letters small . Like if Lieferservice Krefeld is the page , than URL should be (lieferservice/krefeld) means k with small letters. And change for all cities.
If you have any questions let me know . Thanks
I corrected my problem by adding Apostrophe: "deletedNote('{{ note.id }}')"
I don't know if it's a good solution or it can help someone who had the same problem than me.
When I try to render the navbar on the homepage I get a blank screen
I debugged the code multiple times and the program seems to stop when trying to access the home.html template.
{%extends "base.html" %} {% block title %}Home{% endblock %}
Hi Tim,
I am trying to access the app.config from init.py in views.py but it is not recognising app.config
I am using the same file structure as you. I just want to access the app.config in views.py. Do i need to import something?
in init.py
def create_app():
app = Flask(name)
app.config['SECRET_KEY'] = 'xftry'
app.config['UPLOAD_FOLDER'] = myfolder
In views.py: (not recognising app)
f.save(os.path.join(app.config['UPLOAD_FOLDER'], f.filename))
Thank you
Traceback (most recent call last):
File "c:\Users\simpf\Downloads\web dovolepment\main.py", line 4, in
app = create_app()
File "c:\Users\simpf\Downloads\web dovolepment\website_init_.py", line 7, in create_app
from .views import views
ImportError: cannot import name 'views' from 'website.views' (c:\Users\simpf\Downloads\web dovolepment\website\views.py)
Hello,
I have problems to start the server.
I'm using Python 3.8.8 on Windows 10.
When I run the example on the Raspberry, it works flawlessly.
main.py:
from website import create_app
app = create_app()
if __name__ == '__main__':
app.run(debug=True)
init.py:
from flask import Flask
def create_app():
app = Flask(__name__)
return app
this is the result:
runfile('Z:/Python/2021_07_15 Bsp Python Flask/Projektordner/main.py', wdir='Z:/Python/2021_07_15 Bsp Python Flask/Projektordner')
I hope someone can help me. Thank you!
I am getting this error. Added the code as suggested to base.html and home.html
jinja2.exceptions.UndefinedError
im having issues its says "no module named 'flask_SQLAlchemy'. " when I run the code,
If anyone can offer assistance It would be greatly appreciated!
this is the full error message down below
Traceback (most recent call last):
File "/Users/michaelonyejekwe/PycharmProjects/Web Login/main.py", line 1, in
from website import create_app
File "/Users/michaelonyejekwe/PycharmProjects/Web Login/website/init.py", line 2, in
from flask_SQLAlchemy import SQLAlchemy
ModuleNotFoundError: No module named 'flask_SQLAlchemy'
Full traceback:
Traceback (most recent call last):
File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 2464, in __call__
return self.wsgi_app(environ, start_response)
File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\flask\_compat.py", line 39, in reraise
raise value
File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\flask\_compat.py", line 39, in reraise
raise value
File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "W:\Flask-Web-App-Tutorial\website\auth.py", line 62, in sign_up
login_user(user, remember=True)
File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\flask_login\utils.py", line 166, in login_user
if not force and not user.is_active:
AttributeError: 'NoneType' object has no attribute 'is_active'
This happens when I try to sign up.
I have not modified any files.
Hello all,
I have been getting ValueError: invalid literal for int() with base 10: 'None'
for the past few days. This is my first Python project so I don't have much experience. I have no clue what this means so any help will be appreciated.
Edit: This is only happening on chrome, on safari it works perfectly fine.
Hi Tim!
First off thanks a lot for uploading this tutorial, is great!.
I've found an error when executing the file base.html. The error says "user is undefined" and is exactly at line 32. I think there is an undeclared variable or so.
I could make it work deleting that "IF" line so in order to go with the flow.
Thanks a lot!
Stay safe!
Regards,
Martin.-
When i type this for the main.py it shows invalid syntax when i run it
from website import create_app
app = create_app()
if name == 'main':
app.run(debug=True)
and when i type this for init.py it also shows invalid syntax when i run it
from flask import Flask
def create_app():
app = Flask(name)
app.config['SECRET_KEY'] = 'RJVA'
return app
Please suggest what to do. I have checked it with the code on GitHub it is the same still it shows invalid syntax.
from website import create_app
app = create_app
if name == 'main':
app.run(debug=True)
When I run main.py, I get this error "AttributeError: 'function' object has no attribute 'run'"
delete not doesn't work now try changing it
No problem!
Originally posted by @bludenz in #41 (comment)
Seems like the issue is with db.session.commit()
Heres a screenshot of the error:
My code looks right:
@auth.route('/sign-up', methods=['GET', 'POST'])
def sign_up():
if request.method == 'POST':
email = request.form.get('email')
first_name = request.form.get('first_name')
password1 = request.form.get('password1')
password2 = request.form.get('password2')
if len(email) < 4:
flash('Email must be greater than 3 characters.', category='error')
elif len(first_name) <2:
flash('First Name must be greater than 1 character.', category='error')
elif password1 != password2:
flash('Passwords don\'t match.', category='error')
elif len(password1) <7:
flash('Password must be at least 7 characters', category='error')
else:
new_user = User(email=email, first_name=first_name, password=generate_password_hash(password1, method='sha256'))
db.session.add(new_user)
db.session.commit()
flash('Account Created', category='success')
return redirect(url_for('views.home'))
When you write a note, then click the X button to delete the note, it only hides the message to seem like its deleted, while in truth the note is still there in the database.db file
ImportError: cannot import name 'Flask' from 'flask' (unknown location)
code , website , template , folders , interpreter all right . I am editing this project in pycharm , what should I do ?
in my init.py i have this error from flask_sqlalchemy import SQLAlchemy
ModuleNotFoundError: No module named 'flask_sqlalchemy'
Traceback (most recent call last):
File "main.py", line 3, in
app = create_app()
File "C:\Users\samud\OneDrive\Documents\Notes App\website_init_.py", line 21, in create_app
from .models import User, Note
File "C:\Users\samud\OneDrive\Documents\Notes App\website\models.py", line 4, in
class Note(db.Model):
File "C:\Users\samud\OneDrive\Documents\Notes App\website\models.py", line 7, in Note
date = db.Column(db.DateTime(timezone=True), default=func.now())
NameError: name 'func' is not defined
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.