Skip to content

Commit 3807a37

Browse files
committed
Update cherrypy
1 parent 2579815 commit 3807a37

File tree

9 files changed

+51
-4
lines changed

9 files changed

+51
-4
lines changed

cherrypy-bootstrap/src/cherrypy_bootstrap/application/__init__.py

Whitespace-only changes.

cherrypy-bootstrap/src/cherrypy_bootstrap/app.py renamed to cherrypy-bootstrap/src/cherrypy_bootstrap/application/controllers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import cherrypy
22

3-
from utils import render
3+
from src.cherrypy_bootstrap.utilities import render
44

55

66
class CherryApp(object):

cherrypy-bootstrap/src/cherrypy_bootstrap/application/models.py

Whitespace-only changes.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import pathlib
2+
3+
import cherrypy
4+
5+
6+
path = pathlib.Path(__file__).parent.absolute()
7+
app_config = {
8+
"global" : {
9+
"server.socket_host" : "127.0.0.1",
10+
"server.socket_port" : 8080,
11+
"server.thread_pool" : 8,
12+
13+
"engine.autoreload.on" : True,
14+
15+
"tools.trailing_slash.on" : False
16+
},
17+
"/static" : {
18+
"tools.staticdir.on" : True,
19+
"tools.staticdir.dir" : path.joinpath("templates")
20+
}
21+
}
22+
23+
if cherrypy.config.get("environment") == "production":
24+
app_config["global"]["engine.autoreload.on"] = False
25+
app_config["global"]["server.thread_pool"] = 30
26+
app_config["global"]["server.socket_host"] = "0.0.0.0"
27+
app_config["global"]["server.socket_port"] = 80
28+
app_config["global"]["environment"] = "production"
29+
app_config["global"]["log.screen"] = False
30+
31+
else:
32+
app_config["global"]["environment"] = "development"
33+
app_config['global']['log.screen'] = True
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
cherryd -P main -c config.py
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import cherrypy
22

3-
from app import CherryApp
3+
from src.cherrypy_bootstrap import config
4+
from src.cherrypy_bootstrap.application import controllers
45

56

67
if __name__ == "__main__":
7-
cherrypy.quickstart(CherryApp())
8+
cherrypy.tree.mount(
9+
controllers.CherryApp(),
10+
"/",
11+
config=config.app_config
12+
)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% extends 'base.html' %}
2+
3+
{% block content %}
4+
<h1>Error has happened</h1>
5+
{% endblock %}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11

22
{% extends "base.html" %}
33

4+
{% block content %}
45
<header class="hero bg-primary text-white text-center">
56
<div class="container">
67
<h1>Welcome to CherryPy Bootstrap5 App</h1>
78
<p>This is a simple, responsive landing page made with Bootstrap 5.</p>
89
<a href="#" class="btn btn-light btn-lg">Learn More</a>
910
</div>
1011
</header>
11-
{% block content %}
12+
{% endblock %}

0 commit comments

Comments
 (0)