Tuesday, July 1, 2014

How to install cosmos framework

The framework is uploaded to python package index to make it simple to install as library. It is recommended that you use virtualenv, but it is not required.

First create a virtualenv and activate it:

virtualenv --no-site-packages testenv
source testenv/bin/activate
Now install cosmos inside it:
pip install cosmos
A console script named cosmosadmin has now been created for administration tasks. Run new-project command from console from any directory to create new project:
cosmosadmin new-project

The app folder is the root of the webserver in the create project by default. Index page is mapped to serve templates/index.html with current_user passed to it. The /service/* endpoint is mapped to the service handler. You may look into endpoints.py for other endpoints.

After creating the project change the values in the settings.py file (or create a new file named local_settings.py nad add it to your .gitignore file- so this settings does not end up in the source repository) for the database and create admin user:

python cosmosmain.py new-admin
Now start the project:
python cosmosmain.py start-service
And browse to http://localhost:8080/ to see the start page.

3 comments: