-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hello world application with TurboGears
- Loading branch information
Showing
5 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,38 @@ | ||
# python-wiki | ||
|
||
Wiki pages in python | ||
|
||
## How to start | ||
|
||
Clone project | ||
|
||
```shell | ||
git clone https://github.com/BlackCrystal/python-wiki.git | ||
cd python-wiki | ||
``` | ||
|
||
Optional, create virtual python environment and activate it | ||
|
||
```shell | ||
pip install --user virtualenv | ||
virtualenv venv | ||
source venv/bin/activate | ||
``` | ||
|
||
Install requirements | ||
|
||
```shell | ||
pip install -r requirements.txt | ||
``` | ||
|
||
Start webserver | ||
|
||
```shell | ||
python server.py | ||
``` | ||
|
||
Open webpage [http://localhost:8080/](http://localhost:8080/) and wou will see "Hello world" message. | ||
|
||
Now try to build something more incredible, like things we listed [here in the project](https://github.com/BlackCrystal/python-wiki/projects/1). | ||
|
||
GL & HF. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
init: | ||
pip install -r requirements.txt | ||
|
||
test: | ||
py.test tests | ||
|
||
.PHONY: init test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
crank==0.8.1 | ||
MarkupSafe==2.0.1 | ||
repoze.lru==0.7 | ||
TurboGears2==2.4.3 | ||
WebOb==1.8.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from tg import expose, TGController | ||
|
||
class RootController(TGController): | ||
@expose() | ||
def index(self): | ||
return 'Hello World' | ||
|
||
from tg import MinimalApplicationConfigurator | ||
|
||
config = MinimalApplicationConfigurator() | ||
config.update_blueprint({ | ||
'root_controller': RootController() | ||
}) | ||
|
||
application = config.make_wsgi_app() | ||
|
||
from wsgiref.simple_server import make_server | ||
|
||
print("Serving on port 8080...") | ||
httpd = make_server('', 8080, application) | ||
httpd.serve_forever() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#!/usr/bin/env python |