Skip to content

A very simple demo to show how you can use Cedar in Python, with a simple Flask based web application. This code is illustrative and verbose to help explain and show how Cedar works.

License

094459/cedar-flask-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cedar-flask-demo

A very simple demo to show how you can use Cedar in Python, with a simple Flask based web application. This code is illustrative and verbose to help explain and show how Cedar works.

This repo contains the following demo sample app.

├── README.md
└── flask-demo
    ├── app.py
    ├── entities.json
    ├── flask.cedar.policy
    ├── protected
    │   └── images
    │       ├── pic-1.jpeg
    │       ├── pic-2.png
    │       └── pic-3.jpg
    ├── requirements.txt
    ├── schema.json
    ├── static
    │   └── images
    │       └── cedar-green.png
    ├── templates
    │   ├── admin.html
    │   ├── base.html
    │   ├── denied.html
    │   ├── index.html
    │   ├── login.html
    │   ├── photos-manage.html
    │   ├── photos.html
    │   └── public-photos.html
    ├── test.py
    └── users.dat

This demo would not be possible without the excellent work of Stephen Kuenzli and his cedar-py library

Installation

First make sure you have a version of Python greater than 3.9. When I built this I was using 3.10.11, but I have also used version 3.9.3 on my AWS Cloud9 environment. I followed this guide to help me deploy pyenv.

To get this up and running, first create a virtual Python environment

python -m venv cedar-demo
source cedar-demo/bin/activate
cd cedar-demo

Check out the code

git clone https://github.com/094459/cedar-flask-demo.git

Install dependencies

cd cedar-flask-demo/flask-demo
pip install -r requirements.txt

You should now be able to start the application

python app.py

Opening a browser at http://localhost:8080 should bring up the Flask app. To login, check out the users.dat file for sample users.

example homepage of demo

About

A very simple demo to show how you can use Cedar in Python, with a simple Flask based web application. This code is illustrative and verbose to help explain and show how Cedar works.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published