Deploy python 3.6.5 Django app on heroku-18 stack - python

So, I am deploying my first django app to heroku for the first time. I have configured the app locally, pushed it to my remote repository. But when I push the code to my heroku repository, the build fails giving the reason that python 3.6.5 is not available on current stack (heroku-18). It also says here that heroku-18 supports 3.6.6. My simple question is "How do I deploy my python 3.6.5 app on current stack (heroku-18)?"

If you have a runtime.txt file, try changing it to python-3.6.6. 3.6.6 is a maintenance release, so code written for 3.6.5 should run on it fine.

Just try put it in your runtime.txt
python-3.6.4
It's working to me.

Related

Switching python interpreters for Heroku web app [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 months ago.
Improve this question
The problem
For context:
I have deployed an app with Heroku
I have Python 3.9.2 running locally in VS Code vs Python 3.10.8 running on a Heroku machine
I am currently encountering the problems as mentioned on this thread.
I have found the solution to my problem seems to be switching python interpreters and copying my various packages to that location.
However, there is little documentation on how to do this in Heroku.
Any assistance is really appreciated :)
What I've tried
Given the lack of documentation on the above, I've tried the following...
I found that the Heroku deployment was running on Python 3.10.8 runtime, whereas my local machine had been running 3.9.2.
I then added a runtime.txt in the root of the app's directory in Github that specified to use 3.9.2, but when I try and redeploy the build failed.
Following the Heroku logs, this leads me to:
-----> Building on the Heroku-22 stack
-----> Using buildpack: heroku/python
-----> Python app detected
-----> Using Python version specified in runtime.txt
! Requested runtime 'cat runtime.txt
python-3.9.2' is not available for this stack (heroku-22).
! For supported versions, see: https://devcenter.heroku.com/articles/python-support
! Push rejected, failed to compile Python app.
! Push failed
I then realise from the logs, that the build package isn't of 3.9.2 isn't supported.
I've then downloaded python 3.11.0 on my local machine (which is supported, as mentioned here).
Deactivated the current virtual environment (using 3.9.2).
Created a new virtual environment.
Rerun the app locally and checked it works.
I've then added the changes to the git repo.
Then, I've tried to deploy on Heroku. I'm now getting:
-----> Building on the Heroku-22 stack
-----> Using buildpack: heroku/python
-----> Python app detected
-----> Using Python version specified in runtime.txt
! Requested runtime 'cat runtime.txt
python-3.11.0' is not available for this stack (heroku-22).
! For supported versions, see: https://devcenter.heroku.com/articles/python-support
! Push rejected, failed to compile Python app.
! Push failed
I then navigate to the support documentation
I then try and follow the support guidance around 'Checking the buildpack version', as my version of Python is supported, as per the documentation.
I run the command against my CLI which checks which buildpack version I have. I get:
=== [appnamegoeshere] BuildPack URL
heroku/python
So, I have the 'heroku/python' buildpack.
Not sure where to go from here?
Any help is much appreciated :)
The documentation for selecting a runtime says:
To specify a Python runtime, add a runtime.txt file to your app's root directory that declares the exact version number to use:
$ cat runtime.txt
python-3.10.8
The cat runtime part of that is a command that you can run on many systems (Linux, macOS, etc.) to print the contents of a file out. It should not be included in the file.
Your runtime.txt should just contain the appropriate python-x.y.z line. At the moment, on the Heroku-22 stack you can use Python 3.9:
python-3.9.15
Python 3.10:
python-3.10.8
Or Python 3.11:
python-3.11.0
The version you use on your local machine usually just needs to match the major and minor parts: your local Python 3.9.3 should be compatible with Heroku's 3.9.15.
Note that Heroku's list of supported Python versions is updated pretty frequently as new patch releases come out.

Push rejected while deploying on heroku

I am deploying my project with heroku. My Django version number is 3.2.8 and python 3.9.7. It is written on heroku. Heroku supports Python 3.9.7 deployment, but there is an error in my push process. The version above does not support it. What should I do? Thank you for your reply
This is my cmd
my requirements.txt
I haven't used Heroku but I'm curious if this is a problem related to enforced nomenclature on main branch.
A while back I could not push my first commit to a new and empty Git repository if my push command was "git push origin master", it started working after I changed it to "git push origin main" so I suspect this could be the issue you're facing.
Sorry I couldn't ask you before I posted this answer if this is your first push, I do not have enough points to post a comment.
This is due to that Heroku has specific python runtimes.
Visit the link to know : Heroku Supported Runtimes Python
To solve this issue, simply create a runtime.txt file in root folder and add python-3.7.6

How do I specify the Python version in a NodeJS Heroku app?

I'm deploying a NodeJS app through Heroku and utilizing child processes to run some python scripts. I was facing a few syntax errors when the app was first deployed, and after a bit of digging, I found out the python version was 2.7.17 when I needed 3.8 or higher, which made me ask:
How do I specify (or upgrade) the python version for a NodeJS app hosted on Heroku?
After a little looking around I stumbled upon this, which obviously didn't work (else I wouldn't be here asking). I followed the steps and added a runtime.txt file containing "python-3.8.6" (one of the supported python versions by Heroku) but upon checking the python version, 2.7.17 appeared again. I'm assuming the solution linked above focuses on Django/python based servers and doesn't work on NodeJS deployments. Otherwise, I am likely forgetting/missing an important step, which I can't really see anywhere.
Any help is appriciated.

Why is my Python app not compatible with Heroku's Python buildpack

I know this has been asked multiple times before but none of the answers seem to work for my particular case. I created a new Github repository and uploaded the following files to it via the Github desktop client (I tried uploading from the website as well):
Counter.py
Procfile
requirments.txt
The app itself works when I test it locally. This is the Procfile:
worker: python Counter.py
requirments.txt:
git+https://github.com/Rapptz/discord.py
dnspython==1.16.0
PyNaCl==1.3.0
async-timeout==3.0.1
I receive the following error every time I try to deploy it from my Github repository:
-----> App not compatible with buildpack: https://buildpack-
registry.s3.amazonaws.com/buildpacks/heroku/python.tgz
More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
! Push failed
I just don't understand why it isn't compatible with the buildpack but every other app I made is. I tried deploying other apps from other repositories and it worked just fine. Thanks for reading.
You wrote requirments.txt twice instead of requirements.txt.

How to debug dockerfiles when using gcloud and google app engine

I am using Google App Engine and PyCharm 4.0.4 and GCloud managedvm.
I am attempting to access more information about the building of my dockerfile than is given by console output when running locally using dev_appserver.py .
medusavm is a python linux console app that can convert python code to dart code, among other functionalities.
In my dockerfile, medusavm installs without a hitch. I have managed to setup debugging using PyCharm, so I have access to breakpoint debugging functionality, if that is required.
I have a problem with running medusavm, even though it installs without a hitch. At the moment I can only access information from the console. I am running a local debug using the gcloud version of dev_appserver.py, accessed from:
C:/Program Files/Google/Cloud SDK/google-cloud-sdk/platform/google_appengine/dev_appserver.py
I have managed to successfully run the gcloud gae tutorial app using this exact setup, so I think it is a problem with the modifications I have made in my dockerfile to do with installing medusavm.
A link to the text document of my docker file is here and the console output from building from the dockerfile ( the part that I would like more info on for debugging purposes, if you know how to) is here.
If, miraculously, you know the problem that I am facing, (which currently I do not, other than that it originates from not installing medusavm properly), that would be incredibly helpful!
Also, if you happen to know how to debug dockerfiles while using gcloud and gae, I would greatly appreciate that too.
Thank you for taking your time to read this.

Categories

Resources