N
N
neuroepoc2018-03-04 19:30:51
Python
neuroepoc, 2018-03-04 19:30:51

What is the minimum number of files in the project and with what content to deploy the script on Heroku?

There is a script

import sys
print (sys.version[::-1])

What files besides this script should be in the project and what should they contain in order to see the result?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2018-03-04
@neuroepoc

One python script and one Procfile is enough, which contains the command to run the script. The script must, at a minimum, open a socket serving connections. And you will see the result if it is written to the socket.
Using Flask, for example:

import os
import sys
from flask import Flask

app = Flask(__name__)

@app.route("/")
def hello():
    return sys.version[::-1]

if __name__ == "__main__":
    port = int(os.environ.get('PORT', 5000))
    app.run(host='0.0.0.0', port=port)

web: python app.py

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question