Jan-19-2018, 06:05 AM
Hi,
I have a question how can i scrape websites by pressing html button and then save the scrape data into database and then download them whenever required.
This is my office project. A web page where i would have all the scrapers saved and just press download button and it starts downloading data into csv.
I have divided this project into three parts Execute, save into database and download into csv.
Lets discuss part 1-Execute
I have prepared web scrapers in python. I have prepared Html page from where i will execute python scripts, Now how can i execute these python from my views.py in Django.
My folder structure looks like this: Desktop--> Dashboard-->Rera-->Reraapp, rera,temlate, manage.py and dbsqlite3. In template there is a folder files in which i have the attached HTML page saved.
views.py:
suppose my scraper file name is maharashtra.py which is saved where views.y is saved also
In the attached Html page i have scrapers name and buttons like start crawling and download.
Now whenever i press then button start crawling it should start the scrapers.
This is the first part.
**Please Tell me How to save into database for part 2 just a push i need**
I have a question how can i scrape websites by pressing html button and then save the scrape data into database and then download them whenever required.
This is my office project. A web page where i would have all the scrapers saved and just press download button and it starts downloading data into csv.
I have divided this project into three parts Execute, save into database and download into csv.
Lets discuss part 1-Execute
I have prepared web scrapers in python. I have prepared Html page from where i will execute python scripts, Now how can i execute these python from my views.py in Django.
My folder structure looks like this: Desktop--> Dashboard-->Rera-->Reraapp, rera,temlate, manage.py and dbsqlite3. In template there is a folder files in which i have the attached HTML page saved.
views.py:
from django.shortcuts import render from django.conf.urls import url from django.conf.urls import include from django.http import HttpResponse # Create your views here. def index(request): first = {"here":"will enter more details"} return render(request, "files/first-page.html", context=first) #return HttpResponse("<em>Rera details will be patched here</em>")i have saved my scrapers scripts where i have saved the views.py
suppose my scraper file name is maharashtra.py which is saved where views.y is saved also
In the attached Html page i have scrapers name and buttons like start crawling and download.
Now whenever i press then button start crawling it should start the scrapers.
This is the first part.
**Please Tell me How to save into database for part 2 just a push i need**
Attached Files