56 lines
1.4 KiB
Markdown
Raw Normal View History

2025-01-27 18:27:26 +00:00
{% extends "base.html" %}
{% block content %}
{% markdown %}
Welcome to Dreamii, the fastest web framework for Python to build sites with! Dynamic and static! Use Python as template language like PHP. Normally this requires CGI but Dreamii is way faster! Your application is async by default. Also, you can use async await in the py3 block tags.
## Syntax highligthing
### Python
```python
print("Hi, i'm syntax highlighted python")
```
## C
```c
#include <stdio.h>
int main() {
printf("Hi, i'm syntax highlighted c");
return 0;
}
```
{% endmarkdown %}
{% markdown %}# Python database{% endmarkdown %}
{% py3 %}
counter = dreamii.db["counter"].find_one(counter_name="main_counter")
if not counter:
counter = {"count":0,"counter_name":"main_counter"}
counter["count"] += 1
dreamii.db["counter"].upsert(counter,["counter_name"])
print(f"<p>This page had been visited {counter['count']} times.</p>")
{% endpy3 %}
{% markdown %}## Python sub process execution{% endmarkdown %}
{% py3 %}
print("<h3>List first file of directory using `ls`</h3>")
print("<pre>First file: ",system("ls",output=False).split("\n")[0],"</pre>")
print("<h3>Memory information</h3>")
print("<pre>",system("free -h",output=False),"</pre>")
print("<h3>Disk information</h3>")
print("<pre>",system("df -h",output=False),"</pre>")
print("<h3>Process information</h3>")
print("<pre>",system("ps aux",output=False,stderr=True),"</pre>")
{% endpy3 %}
{% endblock content %}