Skip to content
Microweb is a Django web client for the Microcosm API.
JavaScript Python Other
Find file
New pull request
Pull request Compare This branch is 198 commits behind microcosm-cc:master.
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Microweb is a new platform for discussion forums, founded by David Kitchen and Matt Cottingham.

Communities are already using as their forum software of choice, e.g. the Espruino Forum and Islington Cycle Club.

Microweb is the official web client for, written in Django. If you're not familiar with the Microcosm API, you should start by reading the API documentation (it's up-to-date and readable, we promise).

If you find any problems, raise an issue on github and we'll respond ASAP.

Build Status

Project setup

To create a python virtualenv, run the following:

virtualenv -p python2.7 envname
source envname/bin/activate
pip install -r requirements.txt

This will install all dependencies listed in requirements.txt. All commands should be executed with the virtual environment activated.

Project structure

Currently most of the project is contained within the microcosm app (due to be split in a refactor):

├── microcosm
│   ├── api
│   ├── forms
│   ├──
│   ├── middleware
│   ├── static
│   ├── templates
│   ├──
│   ├──
│   ├──

The api package contains classes for communicating with the Microcosm API. If you're familiar with Django, the rest of the packages and modules will look familiar.


Unit tests can be run with:

python test

User authentication

Since authentication is handled by the API, custom middleware is used to provide the authentication context in views. In middleware/

def process_request(self, request):
    Checks for access_token cookie and appends it to the request object
    if it exists. If the access token is invalid, flags it for deletion.

    Populates request.whoami with the result of the whoami API call.

    request.access_token = None
    request.delete_token = False
    request.whoami = None

    if request.COOKIES.has_key('access_token'):
        request.access_token = request.COOKIES['access_token']

        # if a bad access token is provided, flag for deletion
            request.whoami = WhoAmI.retrieve(request.access_token)
        except APIException, e:
            if e.status_code == 401:
                request.delete_token = True


So on each request we make a couple of calls to the API to check if the user has a valid access_token cookie, and retrieve some basic site data (title, description).

Something went wrong with that request. Please try again.