GithubHelp home page GithubHelp logo

vi-u / 16-docker-flask-caesar Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 13 KB

Building Caesar Cipher Tool in Docker using Flask, uWSGI, and Nginx

License: MIT License

Dockerfile 11.49% Python 61.92% HTML 22.24% Shell 4.35%
caesar-cipher docker flask nginx python uwgsi

16-docker-flask-caesar's Introduction

16-Docker-Flask-Caesar

Composing Caesar Cipher Flask App into Docker with uWSGI ang Ngix server

#So, first let's create ywo more template files: form.html for input , and data.html for encrypted message output

sudo nano app/templates/form.html

#which contains

<form action="/data" method = "POST">
    <p>Please enter Phrase to Encript: <input type = "text" name = "Phrase" /></p>
    <p>Please choose your Step: <input type = "text" name = "Step" /></p>

    <p><input type = "submit" value = "Submit" /></p>
</form>

sudo nano app/templates/data.html

#which contains

<p> ... </p>
<p> Encoded message:  </p> <h2> {{result}} </h2>
<p> ... </p>

#Next, modify app/views.py file so that input /form are encripted and have output to /data

sudo nano app/views.py

#which contains this code

https://github.com/vi-u/16-Docker-Flask-Caesar/blob/main/app/views.py

#As we created a new project in our local directory and named it

16-Docker-Flask-Caesar

#then we have to change our PATH in

Dockerfile

#wich will contain

FROM tiangolo/uwsgi-nginx-flask:python3.8-alpine
RUN apk --update add bash nano
ENV STATIC_URL /static
ENV STATIC_PATH /home/vit/Desktop/16-Docker-Flask-Caesar/app/static
COPY ./requirements.txt /home/vit/Desktop/16-Docker-Flask-Caesar/requirements.txt
RUN pip install -r /home/vit/Desktop/16-Docker-Flask-Caesar/requirements.txt

#as well as we need to change the name of our app to "docker.test15"

start.sh

#which contains

#!/bin/bash
app="docker.test16"
docker build -t ${app} .
docker run -d -p 56733:80 \
  --name=${app} \
  -v $PWD:/app ${app}

#and finally, to create and start new container "docker.test15"

cd ..
cd 16-Docker-Flask-Template

sudo bash start.sh

#to verify that docker is running

sudo docker ps

#if nor running, start it

sudo start docker.test16

#To verify visit browser page

localhost:56733/form

#If we were developed our app withing the same local directory, we would have just stop and restart the Docker containers

sudo docker stop docker.test16 && sudo docker start docker.test16

16-docker-flask-caesar's People

Contributors

vi-u avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.