Code Monkey home page Code Monkey logo

talkpython / data-driven-web-apps-with-flask Goto Github PK

View Code? Open in Web Editor NEW
537.0 14.0 505.0 3.16 MB

Course demo code and other hand-out materials for our data-driven web apps in Flask course

Home Page: https://training.talkpython.fm/courses/explore_flask/building-data-driven-web-applications-in-python-with-flask-sqlalchemy-and-bootstrap

License: MIT License

Python 66.87% HTML 22.52% CSS 9.19% Mako 0.58% Shell 0.83%
flask sqlalchemy unit-testing fullstack course online-learning python flask-course course-demo python3

data-driven-web-apps-with-flask's People

Contributors

aambrioso1 avatar daghan avatar fesmondewhite avatar katkaypettitt avatar mikeckennedy avatar trp07 avatar turova avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

data-driven-web-apps-with-flask's Issues

Small error in order of lines in code: Chapter 10 - basic_inserts.py

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

Make it run more easily outside of PyCharm

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.

Ch 12 - Forms - sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread.

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.

Chapter 07

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.

Bluebrint causes 404 not found

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.

Ch 10, Video 7 - Inserting the real Pypi data - where's the load_data.py file?

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?

ModuleNotFoundError: No module named 'pypi_org'

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.

db not creating - Similar to Blueprint 404 issue

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?

Upgrade to sqlalchemy 2.0?

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?

Refactoring view methods with blueprints

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.

Update certbot https instructions

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

ModuleNotFoundError: No module named 'pypi_org' error

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?

Pre-create db folder for users

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.