5👍
Try this:
import os
import sys
sys.path.append('/home/username/www/site_folder')
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'
from django.utils import unittest
from django.utils import simplejson as json
from django.test.client import Client
But replace project
with folder name, where your settings.py
is
4👍
The Client is looking for the settings.py
. You could simply load the client by typing this in your project folder:
python manage.py shell
- [Django]-What does the proxy_pass option in the NGINX config do?
- [Django]-Running Gunicorn behind chrooted nginx inside virtualenv
- [Django]-Encode ImageField in base64 and store it in DB instead of path of the image
0👍
In Pycharm which I use, after following this Running Django tests in PyCharm
my problem was solved.
It’s in the file > settings > Django Support, and then select the right settings.
Source:stackexchange.com