https://github.com/tsarchghs/dyluna
Micro framework for building web applications.
https://github.com/tsarchghs/dyluna
python web-framework wsgi
Last synced: 9 months ago
JSON representation
Micro framework for building web applications.
- Host: GitHub
- URL: https://github.com/tsarchghs/dyluna
- Owner: tsarchghs
- Created: 2018-08-21T23:33:53.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-06T08:26:06.000Z (almost 7 years ago)
- Last Synced: 2025-01-06T09:12:35.265Z (11 months ago)
- Topics: python, web-framework, wsgi
- Language: Python
- Homepage:
- Size: 34.2 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dyluna
A very simple wsgi based python web framework
Example:
```python
app = Dyluna()
@app.route
def hello(environ):
if environ.get("REQUEST_METHOD") == "POST":
name = environ["POST"].get("name")
return render_template("index.html",{"name":name})
return render_template("hello.html")
app.urls.append(["/hello",hello])
@app.route
def hello(environ,name):
context = {"name":name}
return render_template("hello2.html",context)
app.urls.append(["/hello/",hello])
app.run()
```
hello.html
```html
Hello
{% if name %}
Hello, {{name}}
{% else %}
name:
Submit
{% endif %}
```
hello2.html
```html
Hello
Hello, {{name}}
```
Run the code and visit http://127.0.0.1:8080/