Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django Class-based Views Classy Views The View Class

Can I make a scraper written in python to transform it into a Django Web App using CBV?

I have a Spyder app written in Python and I'm wondering if I can make it to work with Django https://github.com/buckyrob

1 Answer

Jeff Muday
MOD
Jeff Muday
Treehouse Moderator 28,722 Points

Sounds like you have some interesting ideas to work on!

You can definitely create a CBV or FBV in Django that could encapsulate web scraping. Pretty much anything you can do with a CBV can be done with an FBV -- I have a slight preference for FBV as it is a little more accessible to Django beginning and intermediate learners.

Linked below, is a simple tutorial I found that covers that a developer writing code to read <H1> tags on a website. She is doing it with an FBV, but nothing prevents someone from rewriting the function-based-view into a class-based-view. Her web scraping functionality is combining the popular "requests" library written by Kenneth Reitz with the "Beautiful Soup" HTML parsing library.

https://pytutorial.com/working-with-django-beautifulsoup-and-requests

Thanks a lot. This gives me the perspective on how to start using CBV for this project. It seems much easier with FBV though. CHeers