Giter VIP home page Giter VIP logo

py2webapp's Introduction

py2webapp

Introduction

py2webapp is a small python program to convert all your scripts to a webapp, without the hassle! You do need to make small modification to your scripts though!

Installation

git clone https://github.com/bkb3/py2webapp.git
cd py2webapp/
pip3 install requirements.txt

Or simply download the latest release from https://github.com/bkb3/py2webapp/releases and extract the files to your favourite directory.

Usage

usage: py2webapp [-h] [-v] -f INPUTSCRIPTFILE -c CONFIG

Convert your scripts to webapp

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         Show program's version number and exit.
  -f INPUTSCRIPTFILE, --inputscriptfile INPUTSCRIPTFILE
                        Your script to convert to webapp
  -c CONFIG, --config CONFIG
                        Configuration file

github@bkb3

How to

There are two steps:

  • Making a config file
  • Modifying your current working script

First make a config file as:

text_input = {
    'Input 1':'arg1',
    'Input 2':'arg2',
}

numerical_input = {
    'Input 3':'arg3',
    'Input 4':'arg4',
}

app_properties = {
    'Name': 'App name',
    'Description': 'Made using py2webapp',
    'Author': 'github@bkb3'
}

Input 1 etc are the name of inputs to your script and should be descriptive enough because they appear in the website later on. The arguments arg1 etc should be named exactly as required by your script to run. There is NO limitation on the number of these inputs. Note that text and numerical inputs should be separate as shown in the config file.

Then modify your actual script by making a dictionary as:

my_dict = {}
my_dict['Results name 1'] = your first result
...

The dictionary keys should be descriptive enough as they appear in the website later on. Finally, instead of returning your results, print this dictionary as print(my_dict).

Once you made these changes, you can use py2webapp as:

python3 py2webapp -f your_modified_script -c your_config_file

The webapp will be generated in the same location as your script as app.py. This needs to be made executable first as chmod +x app.py. Then simply run the app as python3 app.py. Your website will run locally at http://localhost:5050.

Confused? Check the examples directory which has working example scripts and config files.

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.