File tree Expand file tree Collapse file tree 9 files changed +51
-4
lines changed
cherrypy-bootstrap/src/cherrypy_bootstrap Expand file tree Collapse file tree 9 files changed +51
-4
lines changed Original file line number Diff line number Diff line change 1
1
import cherrypy
2
2
3
- from utils import render
3
+ from src . cherrypy_bootstrap . utilities import render
4
4
5
5
6
6
class CherryApp (object ):
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ cherryd -P main -c config.py
Original file line number Diff line number Diff line change 1
1
import cherrypy
2
2
3
- from app import CherryApp
3
+ from src .cherrypy_bootstrap import config
4
+ from src .cherrypy_bootstrap .application import controllers
4
5
5
6
6
7
if __name__ == "__main__" :
7
- cherrypy .quickstart (CherryApp ())
8
+ cherrypy .tree .mount (
9
+ controllers .CherryApp (),
10
+ "/" ,
11
+ config = config .app_config
12
+ )
Original file line number Diff line number Diff line change
1
+ {% extends 'base.html' %}
2
+
3
+ {% block content %}
4
+ < h1 > Error has happened</ h1 >
5
+ {% endblock %}
Original file line number Diff line number Diff line change 1
1
2
2
{% extends "base.html" %}
3
3
4
+ {% block content %}
4
5
< header class ="hero bg-primary text-white text-center ">
5
6
< div class ="container ">
6
7
< h1 > Welcome to CherryPy Bootstrap5 App</ h1 >
7
8
< p > This is a simple, responsive landing page made with Bootstrap 5.</ p >
8
9
< a href ="# " class ="btn btn-light btn-lg "> Learn More</ a >
9
10
</ div >
10
11
</ header >
11
- {% block content %}
12
+ {% endblock %}
File renamed without changes.
You can’t perform that action at this time.
0 commit comments