Skip to content

Commit

Permalink
Hello world application with TurboGears
Browse files Browse the repository at this point in the history
  • Loading branch information
miamibc committed Jun 11, 2021
1 parent eb8a929 commit 9bacf31
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 0 deletions.
36 changes: 36 additions & 0 deletions README.md
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.
7 changes: 7 additions & 0 deletions makefile
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
5 changes: 5 additions & 0 deletions requirements.txt
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
21 changes: 21 additions & 0 deletions server.py
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()
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/usr/bin/env python

0 comments on commit 9bacf31

Please sign in to comment.