Skip to content

fernandoe/the-comics

Repository files navigation

The Comics

Build Status Requirements Status Coverage Status License: GPL v3 Say Thanks!

This is a web service write in Python in order to play with the Marvel API (https://developer.marvel.com) and integrate third party services that helps on building software.

The web service starts picking the Hulk as an initial character and choice a random story that he participates. Bellow the story choiced, the service shows all characters that are in the story. You can select another one clicking in the character picture.

Homepage

Demo

External Services

  • Travis: Continuous integration
  • Requires.io: Keep the project secure by monitoring its dependencies
  • Coveralls: Track your code coverage over time
  • Papertrail: Log management (when app is deployed)
  • Heroku Redis: NoSQL database (when app is deployed)
  • NewRelic Lets developers, ops, and tech teams measure and monitor the performance of their applications and infrastructure.

Some Implementation Highlights

Application Services Map

Services Map

Cache Level 1 - etag

Cache Level 1

Cache Level 2 - Application

Cache Level 2

Installation

Requirements

Environment Variables

Variable Description Default Value
MARVEL_PUBLIC_KEY Your Marvel public key
MARVEL_PRIVATE_KEY You Marvel private key
REDIS_URL Redis connection string redis://localhost
TC_ENABLE_CACHE_L1 Enables the Marvel API cache (etag) False
TC_ENABLE_CACHE_L2 Enables the application cache False
TC_LIMIT_PAGES Limits the number of pages returned in searches

Installing and Running

Redis

You will need Redis installed and running in order to play with the application. You can install it using:

Install locally

Using Docker

docker run --name marvel-redis \
   -p 6379:6379 \
   -v ~/workspace/docker-volumes/marvel-redis:/data \
   -d redis:3.2.6

Steps to Install and Running Locally

$ git clone https://github.com/fernandoe/the-comics
$ cd the-comics
$ virtualenv .venv --python=python3
$ source .venv/bin/activate
$ pip install -r requirements/development.txt
$ export FLASK_DEBUG=1 
$ export MARVEL_PRIVATE_KEY=[your private key]
$ export MARVEL_PUBLIC_KEY=[your public key] 
$ export PYTHONPATH=src
$ export TC_ENABLE_CACHE_L1=True
$ export TC_ENABLE_CACHE_L2=True
$ export TC_LIMIT_PAGES=3
$ python src/app.py

Steps to Install and Running on Heroku

$ git clone https://github.com/fernandoe/the-comics
$ cd the-comics
$ heroku create
$ heroku config:set MARVEL_PRIVATE_KEY=[your private key]
$ heroku config:set MARVEL_PUBLIC_KEY=[your public key]
$ heroku config:set PYTHONPATH=src
$ heroku config:set TC_ENABLE_CACHE_L1=True
$ heroku config:set TC_ENABLE_CACHE_L2=True
$ heroku config:set TC_LIMIT_PAGES=3
$ heroku addons:create papertrail
$ heroku addons:create heroku-redis:hobby-dev
$ heroku addons:create newrelic:wayne  # Install NewRelic
$ heroku config:set NEW_RELIC_APP_NAME='The Comics'  # NewRelic configuration
$ git push heroku master
$ heroku open

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

Playing with the Marvel API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published