Running old django app in new virtual environment - python

I have a django app i was running in python 2.7 and django 1.7.10.However am trying to transition it to django 1.8. I have created a new virtualenv,installed python2.7 and django 1.8 in it and moved the app there.However when i run the server it still reads django 1.7.10.What could be the problem ?
console
enter image description here

You do not need to move application for new virtual environment you just need to activate it probably you did not activate new one. Actually also you do not need a new virtual environment for upgrade. Just pip install -U django==1.8 it will upgrade your django and then make necessary edits.

Related

Django / Anaconda - Can not start server

I made a new django project on a different machine (PC) in a conda enviroment. Now I copied the django project folder and created a new enviroment on the new PC with conda. I installed everything like on the "old" machine but however if I type python manage.py runserver it throws a message:
Image
Does someone know if something is missing or what can I do to run the django project on the new pc?
I have latest conda version 4.8.4, django version 3.0.3
As you make and migrate your migrations they have dependencies on other on other migration files. So, a migration with a dependency to the file in your error message cannot find that migrations file. This has likely happened while copying the project, maybe the file did not copy. If this is a development environment a quick fix would be to delete your local db file, as well as the migrations folder and then re-run makemigrations and migrate.
This could also be a multi app problem where you have a migration dependency to another app, and have not ran the migrations for said app.
django.db.migrations.exceptions.NodeNotFoundError
Django NodeNotFoundError during migration

Django app - What do I install in virtualenv vs system wide?

I'm working on creating my first "real" web app using Django.
Yesterday I learned I should be using a web server like Nginx to serve static files and pass off requests for dynamic content to my web app. I also learned that I need something like Gunicorn as the intermediary between the web server (Nginx) and my Django app.
My question is about virtualenv. It makes sense that we would contain app related software in it's own separate environment. What should I install in virtualenv, and what gets installed system wide? For example, in this guide we seem to install Python, Nginx and the database system wide (because they're installed before virtualenv is installed) while Django and Gunicorn are installed in virtualenv. It makes sense that Gunicorn would have to go in the virtualenv since its importing our python app, as explained here. Are the other things required to be installed system wide? Or can I pick either way? Is one way preferred over another?
Thanks!
Virtualenv is for managing Python libraries. It is not for managing Python itself, or for external services such as databases; it does however manage the Python libraries you use to access the database.
There's no room for confusion here, because there's simply no way to install Python itself or a database within a virtualenv.

Can't run django server from Pycharm

I recently fromated my computer and installed win 10.
I have installed pycharm and python 3.4 with django 1.8.6 .
Then I loaded a django project, which I had on my computer before formatting it and backed it up on Google Drive.
I can run my app through command line with the command "python manage.py runserver" (I am running this command while I'm in the project path), and it's working very well like that.
But I need to run it through pycharm in order to use the debugger.
I've tried to use the "Edit configuration" button, but with no success.
Any help will be appreciated.
I have attached an image.
Edit configuration window:
I had to add a new configuration and not to edit the existing one.
I followed the steps from this post:
How to setup Django project in PyCharm

how to deploy apps developed in virtual env

I have a flask based app, and it's now running with virtualenv on my dev machine. Now I want to deploy it to my virtual host. Sadly, this virtual host is running flask 0.6, and I want flask 0.10. I don't have enough privilege to upgrade it.
Can I just upload my whole virtual environment, and to use my own version of flask, and how?
My idea is change the PYTHONPATH, how to get rid of the old version and add the new into it?
Any help will be appreciated.
Uploading your virtualenv probably won't work. There is a good chance that something in the virtualenv is dependent on the exact file paths and versions that won't match from your machine to the virtual host.
You can upload the virtualenv tool, make a new virtualenv, and then install the version of flask you want inside that virtualenv.

Running WSGI application with a different version of Django to what's installed in python site-packages?

I have an application that uses Django 1.3 installed in python's site-packages. I want to create another copy of it (WSGI under Apache) but make it use a newer version of Django I've unpacked alongside to see if any input is required before I'm able to migrate to 1.4.
Is there a way to somehow specify where WSGI should import Django from?
Run the app inside a virtualenv.
Try to use virtualenv and run uwsgi in it. virtualenv-apache-mod_wsgi

Categories

Resources