talkpython / data-driven-web-apps-with-flask Goto Github PK
View Code? Open in Web Editor NEWCourse demo code and other hand-out materials for our data-driven web apps in Flask course
License: MIT License
Course demo code and other hand-out materials for our data-driven web apps in Flask course
License: MIT License
There is a small error in basic_inserts.py. It probably went unnoticed because it only affects folks that are not using Pycharm. Here's the problem:
import pypi_org.data.db_session as db_session
from pypi_org.data.package import Package
from pypi_org.data.releases import Release
sys.path.insert(0, os.path.abspath(os.path.join(
os.path.dirname(file), "..", "..")))
The code to fix the problem with the system path needs to be place before the imports.
Thanks for the course. I am slogging along steadily.
Cheers!
Alex in Valrico, Florida
PS: Still not haven't worked out how to do pull requests.
I'm getting this error when I run app.py
at the beginning and navigate to any of the package pages.
sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 123145425145856 and this is thread id 123145430401024.
Above it getting this repeating error:
Traceback (most recent call last):
File "/Users/danielmsheehan/GitHub/data-driven-web-apps-with-flask/venv/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 693, in _finalize_fairy
fairy._reset(pool)
File "/Users/danielmsheehan/GitHub/data-driven-web-apps-with-flask/venv/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 880, in _reset
pool._dialect.do_rollback(self)
File "/Users/danielmsheehan/GitHub/data-driven-web-apps-with-flask/venv/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 538, in do_rollback
dbapi_connection.rollback()
To start each I chapter I start by renaming the final
folder to final_
, This is from copying the starter
folder code and naming it final
and then working in that directory.
I didn't see this error in chapter 11, (and I re-ran app.py
to test - not seeing this error in ch. 11). I'm thinking there may be something different in ch 12's code, maybe something was added that after following along will be updated. If so I'll close this, otherwise not sure what to do. If this is in Chapter 13 as well and persists, I'll note that here.
Some folks are experiencing issues where they are getting a list rather than plain dict. I think it's from multiple entries in the multidict. Converting to a regular dict will fix it.
If a user is already logged in, they can manually go to the login page even after they are already logged in. Instead, manually going to the login page if logged in should redirect to the account page.
When the Login button is clicked with empty fields the video shows that password field turns red. This does occur when using Firefox but it does not occur when using Safari on the Mac.
Not a bug per se, but something that may confuse users.
I ran the code from the command line in the final folder of ch06_routing using flask run but get 404 not found for both the homepage and the about page. This was the same when I followed along. The app worked fine before I added the blueprint.
I have a windows 10 machine with python 3.7.3 and I'm using a virtual environment.
the video starts saying we aren't going to write the load_data.py file, but it does not mention where to find it to bring it in to the project
Copying the load_data.py file from the final folder and trying to run it along with this video gives the error:
Traceback (most recent call last):
File "C:/PyWorkspace/data-driven-web-apps-with-flask/app/ch10_using_sqlachemy/starter/pypi_org/bin/load_data.py", line 16, in
from pypi_org.infrastructure.num_convert import try_int
ModuleNotFoundError: No module named 'pypi_org.infrastructure.num_convert'
is there a different load_data.py file we should use here?
Some people are running into issues where the @response()
decorator doesn't filter werkzeug responses correctly.
I'm in ch06_routing and trying to setup the blueprints. register_blueprints is throwing the error:
ModuleNotFoundError: No module named 'pypi_org' all of the imports.
For example from pypi_org.views import home_views
and from pypi_org.views import package_views
both cause the error. I do have a views directory inside of the pypi_org directory, and app.py is at the root of pypi_org.
Inside of the views directory the import of services does not cause this error (import pypi_org.services.package_service as package_service
runs with no error).
I can't figure out why I am getting the error in the app.py file.
Hello! Similar to the previously-noted Blueprint 404 issue which was corrected with:
register_blueprints()
if __name__ == '__main__': main()
I'm now seeing an issue with the db not creating because setup_db is not being accessed. I moved setup_db here:
register_blueprints()
setup_db()
if __name__ == '__main__': main()
... and still nothing, but at least it prints out the connection string. Any ideas for how to solve this?
I don't really know much about sqlalchemy, but I did hear on your podcast that they have a big new version out. How hard would it be to update this project to use the new features/patterns in sqlalchemy 2.0?
Maybe like, one final extra video in the course or something... like an epilogue?
Cannot figure out why everything stops working at the moment when I switch app.py over to use blueprints. I am copying what you do in the video, but when i run app.py, I get a 404 return.
As soon as i switch back to original app.py setup, this work again.
Hey there,
I ran into an issue with the SSL certbot install when revisiting this tutorial for another project I am doing (so I am not following the lesson to the tee here... and maybe the issue is just me ๐ ). The PPA install has been deprecated
# add-apt-repository ppa:certbot/certbot
PPA publishes dbgsym, you may need to include 'main/debug' component
Repository: 'deb https://ppa.launchpadcontent.net/certbot/certbot/ubuntu/ kinetic main'
Description:
The PPA has been DEPRECATED.
Following the instructions from certbot worked for me on Ubuntu 22.1
sudo snap install core; sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
I am having trouble with the Jinja2 templates and the routing and URLs tutorials.
When I follow your code and use:
from pypi_org.infrastructure.view_modifiers import response
import pypi_org.services.package_service as package_service
I get the error:
ModuleNotFoundError: No module named 'pypi_org'
The error doesn't occur when I change the code to:
from infrastructure.view_modifiers import response
import services.package_service as package_service
What am I doing wrong?
Some users are reporting this error because they have not created the db folder first. Not sure whether this was missed or just not emphasized enough in the course but it's no big deal to create that folder in the starter code to help smooth things over:
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
(Background on this error at: (link: http://sqlalche.me/e/e3q8) sqlalche.me/e/e3q8)
During Lesson 09 > Creating tables.
Could be an issue on my end, but the only way I found to make it work is to create the db folder myself.
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.