unable to run django project in other system - django

I have a Django project copied from a system. I have copied it to my system and I have put it in Apache www directory. Now When I run command
$python mamange.py runserver
it is giving error Import Error: NO module named jet
can anyone please identify bug. Thanks in advance

You need to make sure you have all of your dependencies installed. If you have a requirements.txt (or similar) file run pip install -r requirements.txt (in the folder where the file is). Other wise you will need to install the requirements manually pip install <list of requirements>

Related

Virtualenv and django not working in bash on windows 10

I have a problem with using virtualenv and django in bash. If I type python -m venv env in cmd, then env\Scripts\activate, and then virtualenv - I get 'virtualenv' is not recognized as an internal or external command, operable program or batch file.. If I do the same in bash I get bash: virtualenv: command not found. How do I fix this?
Try the following to resolve your issue.
Check all of the environment variables related to the software you require to be used at least.
Check the permissions for files and folders for the software.
Sometimes uninstalling and installing the software with issues can solve problems quickly.
If you have performed number 2. and you are still have errors, proceed to number 3.
You may have dependencies missing, a good tool i have used on Windows is Dependency Walker, and the software will check if any file and dependencies are missing, and you should be able to download them.
An error message may output a file is not found but in fact a dependency is missing, relating to the software you are trying to run.
Try the following steps in the terminal, it may solve your problem.
using terminal, mkdir to make a directory for your project
cd to your project folder/dir
type pip3 freeze, it will show up all the installed packages and dependencies on global scope/system
but we gonna have a venv where we will install our necessary packages and dependencies
type python3 -m venv ./venv to create venv inside your current project folder, please ensure you are inside the folder before running this command
[if you are not using python 3, then the command will be python -m venv ./venv]
to actiavte environment,
on mac, run source ./venv/bin/activate ||
on windows, run .\venv\Scripts\activate.bat [if it doesn't work, try to put your absolute path]
you can check what is installed inside venv using pip freeze, you will see nothing inside the venv
Now you can install django inside venv for your project
to deactivate the environment, just type deactivate

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.

How to install Django project with all modules?

I created a Django's application which use some additional modules like crispy_forms. I would like to send this application to my friends to test it.
But I don't know how can they just install it and run it? Is it possible?
Application using also database PostgreSQL.
What is the simplest way to just run this application from any place with no errors and problems on the start?
I found only information about https://docs.djangoproject.com/en/1.10/intro/reusable-apps/
and packed my app, but I don't know how to install it.
To setup env for project i would install virtualenv, then:
pip install -r requirements.txt
You need to set database connection in settings.py, or switch to sqlite3...
hope this helps!
If you are using virtual environment then activate it and go in your project root.
If you are not using virtualenvironment then do the same thing, go in your project root.
Make sure you have requirements.txt file.
run the command
pip freeze > requirements.txt
This will add automatically all your modules to requirements.txt file
which can be then installed by
pip install -r requirements.txt

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.

Django local install on ubuntu

I am trying to install django locally on ubuntu but cannot get it to recognize admin-django.py. I performed the subversion checkout, moved the django directory on to the python path and then created a symlink to django-admin.py. I can import django from within the python interpreter but cannot run
django-admin.py startproject mysite
Any ideas what I could be missing?
You probably need to give the full path to django-admin.py. Giving us the error message would help.
If your symlink is in the current directory (you don't say) then:
./django-admin.py
should work. Otherwise its
/usr/wherever/python/site-packages/something/django/huh/django-admin.py
Make sure that the django-admin.py file is executable:
chmod +x django-admin.py