0

I am completely new to django and making non-static websites, so I'm sorry if this is a stupid question, but I couldn't find info anywhere on how to actually structure files for a django project.

I built a program that scrapes data from one online store, formats the data, and then adds the item to eBay via ebay python sdk. For this, I wrote three .py files - one that uses the requests library to get product data, one that formats the data into the correct structure to feed into the api, and finally the file that makes the api call. The way I understand eBay SDK, these files all have to be in the ebaysdk directory in order to work (at least, the one that makes the api call has to be in there).

My problem is that I now want to make a simple django website, which takes a product url from the user from that store, and then automatically uploads the product. I am confused about how to make my three .py files work with a django website? Do I have to restructure the whole thing and put them into my views.py file as functions? But then, how can I make the api call with ebay sdk if it's not in the right directory?

  • 1
    Why not import the function to download the data into you django views file, and call it from there? – Nico Griffioen Oct 01 '20 at 11:56
  • Yeah that's what I am doing currently, but I have a problem when I try to get user's input in my views file, and then I need to import that input into the python script, and import what the script returns back into the same views function. I think it might be easier to just put all the product data that those files return into a database and then just import that database? – Emina Merlak Susman Oct 01 '20 at 12:25
  • That kind of depends what kind of product data you are getting, and what you're using it for. If it's data you are retrieving on command from the user, I think it'd be ok to pass it back without saving to a database. – Nico Griffioen Oct 01 '20 at 12:27

0 Answers0