GithubHelp home page GithubHelp logo

muscles's Introduction

README: Muscular Framework

pybabel extract --mapping-file=/apps/app/babelrc --keywords=_ --keywords=_l --keywords=t --keywords=locale --output-file=/apps/gitmodules/muscles/locales/message.pot /apps/gitmodules/muscles/src

pybabel init --domain=message --input-file=/apps/gitmodules/muscles/locales/message.pot --output-dir=/apps/gitmodules/muscles/locales --locale=en

pybabel update --domain=message --input-file=/apps/gitmodules/muscles/locales/message.pot --output-dir=/apps/gitmodules/muscles/locales --locale=en

pybabel compile --domain=message --directory=/apps/gitmodules/muscles/locales

Plans

Completed

  • cli
  • http with wsgi
  • http with server
  • request
  • response
  • redirect
  • header
  • test for wsgi
  • test for http
  • test for cli
  • test for redirect
  • html template

Must

  • route with param and alias (main.index)
  • test for abort
  • configuration
  • auto restart
  • documentation

Routers

from muscles.http import routes, Response

def http_main(request):
    body = '<html><head></head><body>'
    body += f'#HalloMuscularWorld'
    body += '</body></html>'
    return body


@routes.init('/init', method='GET', content_type='text/html')
def main_test1(request):
    body = '<html><head></head><body>'
    body += f'#init GET'
    body += '</body></html>'
    return body


@routes.init('/init', method='PUT', content_type='application/json')
def main_test1(request):
    return [{"init": "PUT"}]


@routes.init('/init', method='LINK', redirect='http://localhost:8080/test')
def main_test1(request):
    return [{"init": "PUT"}]


@routes.init('/init', method='DELETE', redirect=(308, '/test'))
def main_test1(request):
    return [{"init": "PUT"}]


@routes.init('/init', method='GET', content_type='application/json')
def main_test1(request):
    return {"init": "GET"}


@routes.init('/init', method='POST')
def main_test1(request):
    body = '<html><head></head><body>'
    body += f'#init POST'
    body += '</body></html>'
    return body


def http_main(request):
    body = '<html><head></head><body>'
    body += f'#HalloMuscularWorld'
    body += '</body></html>'
    # await asyncio.sleep(5)
    # time.sleep(5)
    return body


def http_main1(request):
    body = '<html><head></head><body>'
    body += f'#HalloMuscularWorld 111'
    body += '</body></html>'
    return Response(200, body=body)


def http_main2(request):
    body = '<html><head></head><body>'
    body += f'#HalloMuscularWorld 111'
    body += '</body></html>'
    headers = [('Star', 1)]
    return (body, 200, headers)


def http_main3(request):
    body = '<html><head></head><body>'
    body += f'#HalloMuscularWorld 111'
    body += '</body></html>'
    headers = [('Star', 1)]
    return (body, 404, headers)


routes.add('/', http_main, method='GET')
routes.add('/test', http_main1, method='*')
routes.add('/test2', http_main2, method='*')
routes.add('/test3', http_main3, method='*')

How do I get set up?

  • Summary of set up
  • Configuration
  • Dependencies
  • Database configuration
  • How to run tests
  • Deployment instructions

Contribution guidelines

  • Writing tests
  • Code review
  • Other guidelines

Who do I talk to?

  • Repo owner or admin
  • Other community or team contact

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.