Webfaction setup Virtualenv - django

I've got to setup a new Django website on a webfaction account, getting issues when I try to run pip this is the error I get when I run
pip install south
OSError: [Errno 13] Permission denied: '/tmp/pip-build/virtualenv'

Webfaction provides instructions on how to install pip and pip packages for use within your local home directory...
http://docs.webfaction.com/software/python.html#installing-packages-with-pip
If you plan on hosting multiple web applications from the same webfaction server, it's probably wise to setup virtualenvs for each application. To do this, I would try the following...
pip install --user virtualenv # install virtualenv via pip
echo 'export PATH="$HOME/bin:$PATH"' >> $HOME/.bashrc # add local bin directory to PATH
source $HOME/.bashrc # reload .bashrc to kick in PATH changes
virtualenv yourvirtualenv --no-site-packages
Hopefully that works. I don't have Webfaction to test but I think that should suffice.

Related

How to configure setup for Django 2.2.8 on Shared or VPS Hosting

I am trying to configure web server for Django 2.2.8 on VPS Server as well as Shared Hosting but both are not working. I have configure python on the web server and its shell is working and giving output . But when I am trying to configure Django but its not working Its Giving the blank screen.
I have followed these steps for Django Configuration and followed this link
https://github.com/sparagus/django-shared-hosting-1and1
Access your server via SSH, which will most likely take you to your base directory (your htdocs directory where the directories to your websites are).
Make a directory where you want your Python files to reside and cd into it.
mkdir python_files
cd python_files
Run the build-python.sh
./build-python.sh
install/python3.6.3/bin/python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
If you get an SSL error here then there's a problem with OpenSSL.
Check if Django is installed correctly.
python -m django --version
Go back to your base directory and start a Django project.
cd ..
django-admin startproject your_site
and so on followed all the steps which are mentioned on the git link but it is showing blank when accessing the url

Could not install packages due to an EnvironmentError in ec2 server

i'm typing the following in my working amazon ec2 linux server. (with ENV activated)
pip install pillow
getting this error:
Could not install packages due to an EnvironmentError:
[Errno 13] Permission denied: '/home/ec2-user/env/lib64/python3.5/site-packages/Pillow-5.1.0.dist-info'.
Consider using the `--user` option or check the permissions.
if i use --user i get:
Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
Based on your answers, what happened is that you used sudo when you created the virtualenv so root owns it.
sudo chown ec2-user:ec2-user -R ~ec2-user/env will fix this and make ec2-user the owner of the directory (and subdirectories) again.

How to move a directory out of ./virualenvs and into my project in PYTHONANYWHERE

Just for the record - I feel so stupid asking this question.
I can not move a directory out of;
home/username/django18/lib/python35/site-packages
into my Django project here;
home/username/my_project
I did a;
pip install django-allauth
to install AllAuth for my project, which in turn dropped it in the above directory, not my project. To be neat and organised... I would like my AllAuth diretory to sit in the main directory of my project..
I have tried using the bash terminal, but can not get to that directory from it.
You should not even try moving the installed package, because it (probably) won't work. Python virtualenvs are not really relocatable.
Just create a new virtual environment in your project directory and install all pip packages there:
cd my_project
virtualenv .env
. .env/bin/activate
pip install -r requirements.txt # if you have a list of pip requirements
pip install django-allauth

installing django-remote-forms on pythonanywhere virtualenv

I want to install django-remote-forms on pythonanywhere virtualenv
but it seems pip repo dose not include django-remote-forms
and also whene I upload the files on pythonanywhere host I dont have required premission
for installing using setup.py
if any one could help me
You can install it directly from github:
pip install --user https://github.com/WiserTogether/django-remote-forms/archive/master.zip

How to install image processing just for a virtualenv project with pip for django

But I'm looking to install freetype, libjpeg, PIL build to add image processing to my django projects I've followed this installation http://dakrauth.com/blog/entry/python-and-django-setup-mac-os-x-leopard/ which installs it site wide but I can get it inside my virtualenv project.
Do I just cd into the working directory of the virtualenv (project) and install it there and will it just be available for that project or do I use pip? I couldn't find the packages in the pip repository. Can someone enlighten me please.
curl -O http://pypi.python.org/packages/source/d/distribute/distribute-0.6.21.tar.gz
tar -xzvf distribute-0.6.21.tar.gz
cd distribute-0.6.21
python distribute_setup.py
easy_install pip
pip install virtualenv
virtualenv --distribute --no-site-packages [myproject]
cd [myproject]
source bin/activate (this activates the sandbox that virtualenv created)
pip install django mysql-python
Go to the working directory of the virtualenv and then run
$ source bin/activate
This will set that virtual environment as your active one. So now that it's active, you can install what you want, either manually (by following those steps on the site you linked to) or with pip and it will automatically install it into your active virtualenv.
If you then, say, run python manage.py runserver while the same virtualenv is active, django will have access to your newly installed package. Once you want to unset that virtual environment as your active one, simply do deactivate.
I ran into something similar; what I did was install it into the default directory (e.g. Python27/Lib/site-packages) then cut and paste all the new files put there into the created environment's site-packages. Hacky, but works.
After that you can follow EEVIAC's instructions to actually get your server running.