import os
import flask

app = flask.Flask(__name__)

@app.route("/")
def hello():
    return "Choose a domain!"

if __name__ == "__main__":
    app.run()


import os
import flask
import inspect

app = flask.Flask(__name__, static_url_path='')

# Home of any pre-build docker files
docker_file_path = os.path.join(os.path.dirname(os.path.abspath(
    inspect.getfile(inspect.currentframe()))), "..", "dockerfiles")

@app.route("/")
def hello():
    return "Choose a domain!"

@app.route("/dfview/<path:fname>")
def send_dockerfile(fname):
    with open(os.path.join(docker_file_path, fname)) as dfile:
        return_value = dfile.read()
    return return_value

if __name__ == "__main__":
    app.run()


Return pre-built dockerfile to user
Return pre-built dockerfile to user

  import os
  import flask
+ import inspect
  
- app = flask.Flask(__name__)
+ app = flask.Flask(__name__, static_url_path='')
+ 
+ # Home of any pre-build docker files
+ docker_file_path = os.path.join(os.path.dirname(os.path.abspath(
+     inspect.getfile(inspect.currentframe()))), "..", "dockerfiles")
  
  @app.route("/")
  def hello():
      return "Choose a domain!"
  
+ @app.route("/dfview/<path:fname>")
+ def send_dockerfile(fname):
+     with open(os.path.join(docker_file_path, fname)) as dfile:
+         return_value = dfile.read()
+     return return_value
+ 
  if __name__ == "__main__":
      app.run()
  
  
Return pre-built dockerfile to user
## Code Before:
import os
import flask

app = flask.Flask(__name__)

@app.route("/")
def hello():
    return "Choose a domain!"

if __name__ == "__main__":
    app.run()


## Instruction:
Return pre-built dockerfile to user
## Code After:
import os
import flask
import inspect

app = flask.Flask(__name__, static_url_path='')

# Home of any pre-build docker files
docker_file_path = os.path.join(os.path.dirname(os.path.abspath(
    inspect.getfile(inspect.currentframe()))), "..", "dockerfiles")

@app.route("/")
def hello():
    return "Choose a domain!"

@app.route("/dfview/<path:fname>")
def send_dockerfile(fname):
    with open(os.path.join(docker_file_path, fname)) as dfile:
        return_value = dfile.read()
    return return_value

if __name__ == "__main__":
    app.run()

