How to install the 3part django app using pip on Openshift - django

Thank for your help at first
I created a app on Openshift (create method pls
refer to https://github.com/drivard/openshift-django-mysql)
Now i want to install pip and a 3part app(such as hitconter), my steps as follow:
1. ssh to remote host
2. cd $OPENSHIFT_TMP_DIR
3. wget http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz
4. tar zxf pip-1.1.tar.gz
5. cd pip-1.1
6. python setup.py install (shell mentioned no write permission)
So how can I install pip and use pip to install app in Openshift?

Add required apps to setup.py file . For example:
#!/usr/bin/env python
from setuptools import setup
setup(
name='YourAppName',
version='1.0',
description='OpenShift App',
author='Your Name',
author_email='example#example.com',
url='http://www.python.org/sigs/distutils-sig/',
# Your 3part apps:
install_requires=['Django>=1.3', 'pil', 'south'],
)

Related

Why django is not installing on ubuntu?

I am trying to install django using pipenv but failing to do so.
pipenv install django
Creating a virtualenv for this project...
Pipfile: /home/djangoTry/Pipfile
Using /usr/bin/python3.9 (3.9.5) to create virtualenv...
⠴ Creating virtual environment...RuntimeError: failed to query /usr/bin/python3.9 with code 1 err: 'Traceback (most recent call last):\n File "/home/.local/lib/python3.6/site-packages/virtualenv/discovery/py_info.py", line 16, in <module>\n from distutils import dist\nImportError: cannot import name \'dist\' from \'distutils\' (/usr/lib/python3.9/distutils/__init__.py)\n'
✘ Failed creating virtual environment
[pipenv.exceptions.VirtualenvCreationException]:
Failed to create virtual environment.
Other info
python --version
Python 2.7.17
python3 --version
Python 3.6.9
python3.9 --version
Python 3.9.4
pip3 --version
pip 21.1 from /home/aman/.local/lib/python3.6/site-packages/pip (python 3.6)
Please help.Thanks
The problem isn't with installing Django, is on creating your venv, I don't create on this way so I will pass the way that i create
Step 1 - Install pip
Step 2 - Install virtaulEnv
check here how to install both
after installed, run python3 -m venv venvthis wil create an venv on your current directory. Initiate them with . venv/bin/activateand so run pip install django. That should work
Try pipenv install --python 3.9

ImageField needs Pillow to be installed

I made a model with ImageField(). But whenever I run python manage.py it says you need to install pillow.ERRORS:
sho.Product.image: (fields.E210) Cannot use ImageField because Pillow is not installed.
HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "python -m pip
install Pillow".
It did tell you how to fix it , You dont have the pillow library installed so the imagefield wont work unless you run python -m pip install Pillow . Running the command will solve the problem
I think you are using old version of Django old version don't support for ImageField() without installing pillow. just update the Django package by running following command
you must do the following:
1- Update pip
python -m pip install --upgrade pip
2- If you already install Django update by using the following command
pip install --upgrade Django
or you can uninstall it using the following command
pip uninstall Django
3- If you don't install it yet use the following command
python -m pip install Django
4- Type your code
Enjoy
Install Pillow library, pip install Pillow
in your models.py import Pillow as below
from PIL import Image

Django installation on Mac

I'm trying to install Django on Mac, Python version 3.7 already installed , here is the comment I have put in terminal-
Django-admin startproject hello
command not found
pip install virtualenv ,
virtualenv some name inside the less than and greater than sign ,
and then cd into the directory and run:
,
source bin/activate,
pip install Django
hope this will help you.. :)
Follow the following steps to install and use django
Install django. $ python -m pip install --upgrade django
Now, check the installation $ python -m pip freeze | grep django
Create django project $ django-admin startproject mysite
What i see wrong in your question ? You are using Django-admin

how to install pip remotely using ssh

Hi I hope someone can point me in the right direction.
I am trying to upload a django project which I have developed locally on my machine and now moved the project files to a server and am trying to install django on the server.
I have Python 2.7.5 installed and accessed the server remotely using ssh (putty) I can confirm Python is installed by running the command python --version
I don't have pip installed as when i run the command pip --version
I get following notification
-bash: pip: command not found
I am new to django and python so not sure what I should do to install both django and pip.
p.s In my requirements file and when working locally I have pip and django installed correctly and all working.
Ok, lets say you are already on your remote server. First thing to do is to install pip for your version of python. You can do this via:
sudo apt-get install python-pip
From now you have pip installed. Next thing to do is to install django globally in your system:
pip install django==1.11
Please note that django 1.11 is the last version that supports
python2
Next thing to do is to create django app:
django-admin startproject test_project
And the last thing is to install virtualenv
To install libraries for each of your django projects and keep them
separate
pip install virtualenv
Also note
If you have requirements.txt file with all libs, you can do something like this on your remote server:
pip install -r requirements.txt
That will automatically install all libraries at once
First you should understand which OS you're running:
uname -a
and:
lsb_release -a
When you find the OS version, you can easily follow this guide:
https://packaging.python.org/guides/installing-using-linux-tools/#installing-pip-setuptools-wheel-with-linux-package-managers

django installation not working virtualenv

I have installed virtualenv
pip3 install virtualenv
create a virtualenv
virtualenv djangoenv
access the virtualenv
source ./djangoenv/bin/activate
Then I install
pip3 install django
when import django I get errorno module named django
django-admin.py --version displalys 1.9.4 So it is installed. what am I doing wrong ??
Install virtualenv with pip :
sudo pip install virtualenv
create Virtualenv
virtualenv -p /usr/local/bin/python3 virtualenv_name
activte Virtualenv
source virtualenv_name/bin/activate
finally install django
pip install django
With that you will get django installed using python3