How to Install Pillow on Openshift - django

I'm trying to deploy my django web application on OpenShift. When I try to deploy it I get this error:
I have no idea how I can access the terminal in the openshift to install pip.

Add pillow==6.2.1 on your requirements.txt and deploy again, OpenShift will read thi's file and install all requirements.

Related

Heroku app crashes after pushing change with new dependencies

So I have a Django web app running on Heroku. I recently pushed an update where I added some API functionality via the Django Rest Framework. I installed this via pip. Now my Heroku app crashes. I assume I somehow need to install this dependency on Heroku? Here is the error message:
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail
I tried entering the Heroku CLI and typing pip install djangorestframework but and running Heroku restart but it still crashes.
Edit: some more details, I tried installing this dependency on my machine via git clone in addition to pip. When I pushed this code to Heroku, in the command line I see cannot stat '/tmp/build_5917e4123a7c/requirements.txt': No such file or directory
Edit2: Just to keep this post updated, I'm not trying to add a requirements.txt file to my project with this dependency in it. The file is in the root directory and the only text in it is:
djangorestframework==3.11.0
Edit3: I fixed it. See my answer
So I installed my dependency with pip install djangorestframework but I needed to use pipenv install djangorestframework. The Pipfile therefore never had this dependency added so Heroku wasn't able to see it since it seems Heroku checks the Pipfile. I guess requirements.txt is the old deprecated way to do this?

Install poppler onto Heroku Server django

I am trying to install poppler on my Heroku server because I am using pdf2image as a python package. However, I can't just run brew install poppler like I did on my Mac.
I have tried to add some heroku buildpacks off the internet but with no luck. Anytime pdf2image runs I get this error.
pdf2image.exceptions.PDFInfoNotInstalledError: Unable to get page count. Is poppler installed and in PATH?
Is there something I can do on the command line to get poppler installed while keeping heroku/python as my buildpack?
You can install APT packages with an experimental function on Heroku
Steps:
Add the buildpack to Heroku.
heroku buildpacks:add --index 1 heroku-community/apt
Make a file named Aptfile in your project folder and write poppler-utils inside.
Commit and push.
Is there something I can do on the command line to get poppler installed while keeping heroku/python as my buildpack?
Heroku lets you run multiple buildpacks. I haven't tried this buildpack, but I'd recommend adding this buildpack to your existing app:
heroku buildpacks:set heroku/python
heroku buildpacks:add --index 1 https://github.com/survantjames/heroku-buildpack-poppler.git
Then redeploy your application.

Upgrade django in a dokku environment

I need to upgrade the version of django that is running in a dokku container.
I tried
dokku run staging pip install Django==1.8.18 --upgrade
But when I checked the django version it was still 1.8.13
I've also tried dokku ps:rebuild staging, also with no result.
How am I meant to do the upgrade?
You should update your requirements.txt and re-push your application. Containers created via the dokku run command are one-off, ephemeral containers.

confusion in deploying module's with django

Good day.
I'm a newbie to Django and I have a slight confusion:
When deploying my Django app, do I need to deploy it with all the Python 'come-with' modules, or the hosts already have them installed.
Also, I installed PIL for image manipulation. Would they also have it installed or i have to find a way to install it on their servers. Thanks in advance
do I need to deploy it with all the Python 'come-with' modules
Never do that. It might conflict with the dependencies on the server. Instead issue the following command to create a dependency file (requirements.txt).
pip freeze > requirements.txt (issue this command where manage.py is located)
On the server create a new virtual environment. Now copy django project to the server (you can do this using git clone or just plain old Filezilla). Activate virtual environment. Then change you current working directory to the where manage.py is located. to install all the dependencies issue the following command.
pip install -r requirements.txt
This will install the required dependencies on on server.

Heroku installing outdated requirements file

Im attempting to deploy a Django app using Heroku.
When I first ran
$ git push heroku master
My original requirements.txt had outdated dependencies and Django failed to deploy. After I edited my dependencies and attempted to deploy I noticed that Heroku is still attempting to install dependencies that I erased. Am I doing something wrong here?