I am trying to push a python3 app to Bluemix, but get the error msg "missing start command". I have tried to add -c "python appname.py" as Python usually has in Windows and -c "python3 appname.py" as in Python in Linux, but neither works for me. Can anyone give me the right start command to use?
相关问题
- Django __str__ returned non-string (type NoneType)
- How to postpone/defer the evaluation of f-strings?
- ImportError shows up with py.test, but not when ru
- Comparing pd.Series and getting, what appears to b
- Django Attribute error 'datetime.timedelta'
相关文章
- Airflow depends_on_past explanation
- Raspberry Pi-Python: Install Pandas on Python 3.5.
- Numpy array to TFrecord
- How to split a DataFrame in pandas in predefined p
- Error following env.render() for OpenAI
- AttributeError: 'Series' object has no att
- ImportError: cannot import name 'joblib' f
- How to save a file downloaded from requests to ano
When you push an app to Bluemix you have several options for setting your start command; you can use -c with the cf push command, you can put details into a Procfile, or you can put a command: line in your manifest.
Some documentation here: https://docs.cloudfoundry.org/devguide/deploy-apps/app-startup.html
I find the easiest is to put it in manifest.yml along with the rest of my instance configuration.
The following example creates two Python apps, both using the same code, bound to a shared postgres database and cloudamqp service. The first is a Django frontend, the second starts background celery workers:
It only took me half a day to figure out some of this syntax, so I hope someone apart from me finds this useful in future.
You can define the start command in a file called
Procfile
. Create theProcfile
in the root of your app code that you push to Bluemix. The contents of theProcfile
should look like this:web: python3 appname.py
where appname.py is the nameof your python script to run
The Python buildpack in Bluemix defaults to python-2.7.9. You need to explicitly tell Cloud Foundry that you are using a different version of Python. To do this, add a file called
runtime.txt
to your app's root folder. This file's contents should simply be the Python version you are trying to use, like the following:See here for more info: https://www.ng.bluemix.net/docs/starters/python/index.html#pythonversions
You do not need to add the start command option in your push command. However, you should have a
Procfile
in your app's root folder that has this start command. It should look like the following:where appname.py is your server init file.