Giter VIP home page Giter VIP logo

framework's Introduction

Framework

Framework is a WSGI application which can be configured with routes for both static and dynamic content.

Here's an example of an application which

  • serves static content out of the static_folder directory
  • calls the hello_world() function to provide the content for the path /hello_world
  • calls the user() function for paths which match /user/<name> where the characters appearing after the second slash but before a possible third slash are passed as an argument named name
from framework import Framework

def hello_world():
    ...

def user(name):
    ...

app = Framework('static_folder')
app.add_url_rule('/hello_world', hello_world)
app.add_url_rule('/user/<name>', user)
app.run('www.example.com', 80)

Framework accepts an optional argument which specifies the directory containing static files. It defaults to static.

The run command takes a hostname and port as arguments. The default values are '127.0.0.1' and 5000.

Variable names can contain letters, digits and underscores. URLs can contain letters, digits, underscores, hyphens, periods and tildes.

When a URL with a trailing slash has been configured and the URL is accessed without the trailing slash, a 301 redirect will be issued to the URL with the trailing slash.

Requirements


The waitress and WebOb libraries are required to use Framework. pip install -r requirements.txt will install them.

Example


An example application has been included which demonstrates the different type of URLs supported by Framework.

python example.py runs the application. The index page can be reached in a browser at localhost:8080/.

To Do


  • Handle POST requests
  • Template support

framework's People

Contributors

staceysern avatar

Stargazers

Oz Tamir avatar Sami LABED avatar victor felder avatar

Watchers

James Cloos avatar  avatar

Forkers

alongyaa sjl421

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.