Heroku won't run latest python file - python

I use Heroku to host my discord.py bot, and since I've started using sublime merge to push to GitHub (I use Heroku GitHub for it), Heroku hasn't been running the latest file. The newest release is on GitHub, but Heroku runs an older version. I don't think it's anything to do with sublime merge, but it might be. I've already tried making a new application, but same problem. Anyone know how to fix this?
Edit: I also tried running Heroku bash and running the python file again

1) Try to deploy branch (maybe another branch)
2) Enable automatic deploy

Related

How can you change your python code after you deploy it to heroku using git , without downloading and reinstalling requirements everytime? [duplicate]

Im using django 3 and Python 3.7.4
I don't have any issues with the deployment and the project is working, it's just the first time I face this issue.
Normally when deploying to Heroku all packages in the requirements file get installed during the first deployment process, and any further deployment will only update or install the new packages the get added.
In my case, everytime I deploy, heroku is installing the whole packages again.
Please advise if there is a way to handle this issue.
thanks
This looks like a current issue with the Heroku python buildpack. As long as the issue persists the cache is cleared on every build, since the sqlite3 check is broken. Suggest upvoting the issue on GitHub.

heroku keeps installing django packages during each deployment

Im using django 3 and Python 3.7.4
I don't have any issues with the deployment and the project is working, it's just the first time I face this issue.
Normally when deploying to Heroku all packages in the requirements file get installed during the first deployment process, and any further deployment will only update or install the new packages the get added.
In my case, everytime I deploy, heroku is installing the whole packages again.
Please advise if there is a way to handle this issue.
thanks
This looks like a current issue with the Heroku python buildpack. As long as the issue persists the cache is cleared on every build, since the sqlite3 check is broken. Suggest upvoting the issue on GitHub.

How do I host my discord.py bot on heroku?

I am currently trying to get my discord bot on to Heroku and host it 24/7 but I am having problems.
I uploaded my bot to github https://github.com/zemocode/flankebot/tree/master
I have created the two main files I needed
I clicked deploy branch on Heroku and I'm getting this error.
! No default language could be detected for this app.
HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
See https://devcenter.heroku.com/articles/buildpacks
! Push failed
I have followed tutorials but everyone else has node.js and I so mine doesn't work.
You're missing a couple of things to make this work, for the sake of everyone Googling how to host discord.py on Heroku and getting this as the top result here's a step-by-step
Install Git and do git init when inside your directory
(If you're using virtualenv or similar go into it and) do pip freeze then copy the contents you get to a file called requirements.txt and save it in the same repository as the bot
Make a file (a file of type file)
, open it with notepad and write worker: python name_of_bot_file.py and save within the same repository
Make a text file called runtime.txt and paste python-3.6.5 or whichever python version you were using to write the bot and save it in the same repository.
(If you're inside virtualenv get out and) open your console and write heroku login and input your heroku login details
Then do heroku apps:create name_of_app and heroku buildpacks:set heroku/python
Finally, do git push heroku main or git push heroku branch_name:main if you want to only push one branch
your procfile isn't right. a web application(web:<command>) is for websites (which your bot isn't). the right one is worker: python3 bot.py.
Also, you need a requirements.txt. inside the file, write every module you need to download. in your case, its just discord.py.

Can I use Heroku as a Python server?

My web host does not have python and I am trying to build a machine learning application. I know that heroku lets you use python. I was wondering if I could use heroku as a python server? As in I would let heroku do all of the python processing for me and use my regular domain for everything else.
Yes, and it may be a pain at first but once it is set I would say Heroku is the easiest platform to continually deploy to. However, it is not intuitive - don't try and just 'take a stab' at it; follow a tutorial and try and understand why Heroku works the way it does.
Following the docs is a good bet; Heroku has great documentation for the most part.
Here's the generalized workflow for deploying to Heroku:
Locally, create your project and use virtualenv to install/manage
libraries.
Initialize a git repository in the base dir for your
Python project; create a heroku remote (heroku create)
Create a
procfile for Heroku to use when starting gunicorn (or see
the options for using waitress/etc); this is used by Heroku to start your process
cd to your base dir; freeze
your virtualenv (pip freeze > requirements.txt) and add/commit
requirements.txt. This tells Heroku what packages need to be installed, a requirement for your deployment to work. If you are trying to run a Python project and there are required packages missing, the app will be unable to start and Heroku will display an Internal Server Error.
Whenever changes are made, git commit your changes and git push heroku master to push all commits to Heroku. This will cause Heroku to restart the server application with your updated deployment. If there's a failure, you can use heroku rollback to just return to your last deployment.
In reality, it's not a pain in the ass, just particular. Knowing the rules of Heroku, you are able to manage your deployment with command-line git commands with ease.
One caveat - If deploying Django, Flask applications etc there are peculiarities to account for; specifically, non-project files (including assets) should NOT be stored on Heroku as Heroku periodically restarts your 'dyno' (server instance(s)), loading the whole project from the latest push to Heroku. With Django and Flask, this typically means serving assets/static/media files from an Amazon S3 bucket.
That being said, if you use virtualenv properly, provision your databases, and follow Heroku practices for serving files and commiting updates, it is (imho) the absolute best platform out there for ease of use, reliable uptime, and well-oiled rolling deployments.
One last tip - if you are creating a Django app, I'd suggest starting your project out of this boilerplate. I have a custom one I use for new projects and can start and publish a project in minutes.
Yes, you can use Heroku as a python server. I put a Python Flask server on Heroku but it was a pain: Heroku seemed to have some difficulties, and there were lots of conflicting advice on getting around those. I eventually got it working, can't remember what web page had the ultimate answer but you might look at this one: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xviii-deployment-on-the-heroku-cloud
Have you done your Python Server on Heroku by using twisted?
I don't know if this can help you.
I see the doc 'Getting Started on Heroku with Python' is about the Django.
It is sure that Heroku can use Twisted from docs
Pure Python applications, such as headless processes and evented web frameworks like Twisted, are fully supported.
django-twisted-server has twisted in django but it isn't on Heroku.

Deploying with python 3 on Heroku

I'm trying to deploy to heroku and using python 3. However the heroku build pack defaults to python 2.7.
The build pack read me mentions that a runtime.txt file can be added to change the default runtime.
I'm not clear on the instructions but I've added a runtime.txt file to the root of my project folder with
python-3.4.3
in it. After this if I do:
heroku create
then:
git push heroku master
This doesn't work and still commences the build python 2.7.
Note I do get a custom build pack detected notification.
The information you gave is vague, but if you're following the steps exactly as you say, then you're forgetting to git add and git commit before pushing to heroku.

Categories