简体   繁体   中英

How to trigger Python script from HTML input?

I'm struggling with one part of building a website. I'm using Vue for the front end and Python for the backend. These are the steps I need to take:

  1. Take a text input in a HTML text box:

     <div class="search-wrapper"> <input type="text" v-model="search" placeholder="Enter Stock Ticker"/> </div>
  2. Run a python script that uses that text to run a Tweepy API search:

     t = tweetObj.tweetObject({{ html input here }}) tweet_string = t.get_created_at()
  3. Do a bunch of sentiment analysis (which is already done)
  4. Fill in a bunch of charts on a website (which I already have a template for)

What I don't understand is whether or not I need to use Django or Flask for the Python IO. Is this necessary to take the inputs or can I get by with just simple HTTP request modules? I do understand running everything in one server, but the front end part is very new to me and I'm confused. Would appreciate some guidance on this.

Your question is more based on what your requirement is, so I will suggest you to identify your Requirement and the scope of Project . You can use basic classification like this:

  1. Simple Request module : For very small project with no future plan to launch to public. Planning to use it just for Class project or learning.

  2. Flask : It is a Framework, light-weight, highly flexible and modular. Best to be used for any kind of project ranging from small to large. It's best to use it as Backend for Web Apps or Mobile App Backend.

  3. Django : It is large Framework providing most of the things you might need to develop large to very large projects by default in itself. It gives additional security, modularity. Use it only if planning to build an application with a large user base

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM