Django Heroku - ModuleNotFoundError: No module named 'django_heroku' - django

I am deploying on heroku a website but I am experiencing some issue.
My project is called mysite-project.
I did the following:
1) Create a Procfile containing:
web: gunicorn mysite-project.wsgi
at the base root of my project (same level where manage.py is).
2) app/settings.py
import django_heroku at the top
django_heroku.settings(locals()) at the bottom of settings.py
3)
pip install gunicorn
pip install django-heroku
pip freeze > requirements.txt
4) If I run python manage.py runserver I get:
ModuleNotFoundError: No module named 'django_heroku'

There was a problem with:
pip install django-heroku
It was not fully installed because thee was a problem with psycopg2 that was not installed.
To install psycopg2, run:
pip install psycopg2
Then you can run pip install django-heroku and the error disappeared

I had the same problem as well. I have psycopg2 installed. (for postgres)
Installing 'psycopg2- binary' solved my problem.

For me, the error was due to adding django-heroku to installed apps in settings.py..,removing it solved the issue.

Related

hi can help me in this issu wth database whith django

django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named 'psycopg2'
how can resolv this issue .im alrady install psycopg2 in my vertualenv
activate your env and do a pip install
cd /path/to/virtualenv
source name-of-vitualenv/bin/activate
pip3 install psycopg2

An error while migrating -"no module named 'social_django'."

I have installed python-social-auth==0.3.6. Then I migrated and got an error:
from social_django.models import AbstractUserSocialAuth, UserSocialAuth, Nonce, Association, Code, DjangoStorage
ImportError: No module named 'social_django'
[UPDATE]: What worked for me was this:
In a clean virtualenv I pip install python-social-auth[django]
I included 'django_social', in my INSTALLED_APPS
I run migrations, ./manage.py migrate
You need to install python-social-auth[django]:
pip install python-social-auth[django]
And then add 'social.apps.django_app.default' to your INSTALLED_APPS.
Then don't forget to run the migrations: ./manage.py migrate
I resolve with
pip install django-rest-framework-social-oauth2==1.0.4 social-auth-core==0.2.1 python-social-auth==0.2.21 django-oauth-toolkit==0.10.0

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

cannot run django_quiz app. manage.py not found

I was trying to install the django_quiz app that was found on github.
https://github.com/tomwalker/django_quiz
And as you can see below, i've installed all requirements. but there's no manage.py. How do i start and run the project?
Things I did >
Cloned the repo with git clone https://github.com/tomwalker/django_quiz.git.
Run --> pip install -r requirements.txt.
Run --> python setup.py install
Added 'quiz', 'multichoice', 'true_false', 'essay' to INSTALLED_APPS setting.
Added url(r'^q/', include('quiz.urls')), to urls.py.
NB: I'm a beginner in Django. Please help me. I'm kind of stuck here.
Django Version : 1.6.5
Installed c:\python27\lib\site-packages\django_quiz_app-0.5.1-py2.7.egg
Processing dependencies for django-quiz-app==0.5.1
Searching for Pillow==2.5.0
Best match: Pillow 2.5.0
Adding Pillow 2.5.0 to easy-install.pth file
Using c:\python27\lib\site-packages
Searching for Django==1.6.5
Best match: Django 1.6.5
Adding Django 1.6.5 to easy-install.pth file
Using c:\python27\lib\site-packages
Searching for django-model-utils==2.0.3
Best match: django-model-utils 2.0.3
Adding django-model-utils 2.0.3 to easy-install.pth file
Using c:\python27\lib\site-packages
Finished processing dependencies for django-quiz-app==0.5.1
C:\Users\Vaisakhan\django_quiz>python manage.py runserver
python: can't open file 'manage.py': [Errno 2] No such file or directory
I think this repo misses some steps. I think the steps should be as follows:
pip install virtualenv (you can skip this step and the next one if you are sure that there will not be any dependency error.)
virtualenv ~/quiz_env
source ~/quiz_env/bin/activate
pip install Django==1.6.5
django-admin startproject quiz_project
navigate to quiz_project/quiz_project, edit setting files
navigate to quiz_project/ and copy all the apps directory ('quiz', 'multichoice',....etc) inside quiz_project along with requirement.txt file
pip install -r requirements.txt
python manage.py syncdb
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
Create a manage.py file and store it in the top folder of your file structure. Replace mysite with the folder holding your django quiz code.
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)

Django : Cannot Import name xrange

I am new to python and django. I had django running properly in my machine, till I installed django-haystack. I directly downloaded django-haystack.zip from github and executed 'python setup.py install' in haystack dir. After this whenever I run 'django-admin.py runserver' I am getting the following error : ImportError: cannot import name xrange.
If I remove 'haystack' from INSTALLED_APPS the above command is working fine.
I also cannot run 'python manage.py build_solr_schema' because of the same error.
Let me know how I can resolve this issue.
Solved the issue. Deleted the haystack installation from /usr/local/.../dist-packages/ and used pip install django-haystack to install. That worked fine
This:
http://pypi.python.org/pypi/haystack/
is not the same as this:
http://pypi.python.org/pypi/django-haystack
but if you have them both in your requirements.txt file for some reason, like so:
haystack
django-haystack
and install them into the same virtualenv then you will have problems because they both want to unpack to a directory named 'haystack'. 99% of the time if you're doing django development you don't want that first one at all. So remove it from the requirements.txt file, remove all traces of anything to do with haystack from your virtualenv and then reinstall with:
pip install -r requirements.txt
and you should be good to go.
if you have installed haystack and django-haystack, uninstall both haystacks and install django-haystack
pip uninstall haystack
pip uninstall django-haystack
pip install django-haystack
if you have it installed and still this error appears
uninstall haystack and reinstall it
pip uninstall haystack
#here ask for y/n type y :)
pip install haystack
that works for me