Pipfile.lock (d67565) out of date, updating to (4f9dd2) - django

Can somoene explain why i get this error Pipfile.lock (d67565) out of date, updating to (4f9dd2)…when i try to install packages using pipenv .Altoough i have used pipenv install
enter image description here

I noticed that it happens due to following reasons,
when you install a new app from terminal using pipenv.
secondly when you run pipenv shell command again after closing your project,
also when you make some changes in your pipfile, and lastly when you deploy your project on somthing like heroku.

Related

pipenv install django fail

I am using pipenv to install django, but I get an Error.
Usage: pipenv install [OPTIONS] [PACKAGES]...
ERROR:: --system is intended to be used for pre-existing Pipfile installation, not installation of specific packages. Aborting.
Before I try to create another project in the same directory that the last project exists, somehow, the last virtualenv was not deleted, so I look into other pipenv commands, and there is one pipenv --rm which helps Removing virtualenv that the last project left behind.

pipenv updates all dependencies bringing breaking changes

I'm having problems with an app that uses Django. Everything is in a docker container, there is a pipfile and a pipfile.lock. So far, so good.
The problem is when I want to install a new depedency. I open the docker container shell, and I install the dependency with pipenv install <package-name>.
After installing the package, pipenv runs a command to update the pipfile.lock file and doing so updates all packages to their last version, bringing whit these updates a lot of breaking changes.
I don't understand why is this happening, I have all packages listed in my pipfile with ~=, this is suppose to avoid updating to versions that can break your app.
I'll give you an example, I have this dependency in my pipfile: dj-stripe = "~=2.4". But, in the pipfile.lock file, after pipenv runs the command lock, that depedency is updated to its last version (2.5.1).
What am I doing wrong?
Are you sure you're installing it within Docker? A common cause of pipfile.lock conflicts is installing a package locally instead of within Docker and then when the local environment syncs with Docker it will override your pipfile.lock.
Assuming you're using docker-compose, this is how I'm installing my packages:
docker-compose exec web pipenv install <package-name>
I discovered what my problem was.
I've been listing the dependencies like this: ~=2.4, I thought that was indicating not to update to 2.5 or greater, but that's not true, that only tells pipenv not to update to 3 or greater.
In order to stay in 2.4 version, I must specify the last number version, for example: ~=2.4.0
That way, I'm telling pipenv not to update from 2.4.

how to bring out django project from virtualenv

I have django project in virtualenv and now I am publishing it in server but the problem is I can not move project from virtualenv, when I do this then related packages inside site-package, cant be read and errors occur, how can I bring out my project from virtualenv without any issuing
Create a new virtualenv on the server. It's easy
Step 1 Get the list of modules in the current virtualenv
source /path/to/current/bin/activate
pip freeze > /tmp/requirements.txt
Step 2 Create a new virtualenv. Login to your new server, copy the requirements file there. Then either change into a suitable directory before excuting the virtualenv command or give a full path.
deactivate
virtualenv -p python envname
Step 3 Install modules
source envname/bin/activate
pip install -r /tmp/requirements.txt
That's it.
As #bruno has pointed out, you really should be using a virtualenv on the server. And you should be using it on your local dev server as well. Then you can be really sure that the code will run at both ends without any surprises.

Django Twilio module is not getting installed on Heroku

I tried below 2 methods to install django_twilio module on Heroku
1) Ran 'heroku run pip install django-twilio'
2) Added 'twilio==3.6.3' to requirements.txt and start the server on heroku.
When I run 'heroku run pip freeze' I can see the twilio entry. But when I go into python and run 'import django_twilio' I get a module not found error.
Please suggest how to fix this on heroku. Same steps worked fine on my local machine.
You didn't add the proper requirement, you only installed the twilio library. Your requirements.txt should include the following line:
django-twilio==0.4
Which will include all the other dependencies you'll need. The full pip freeze, after installing django-twilio looks like this:
Django==1.5.5
django-twilio==0.4
httplib2==0.8
six==1.4.1
twilio==3.6.3
unittest2==0.5.1
As a rule of thumb, always run pip freeze > requirements.txt before pushing an update to Heroku (assuming new dependencies were installed), to make sure you have a complete snapshot of your environment.

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.