How to disable internal django tests? - django

I installed django and wrote some small app. After I tried to run my tests with ./manage.py test and saw that django ran 419 tests, but I wrote only 2 of them. As i understand it`s some kind of internal Django tests. How I can disabled them and where are they actually from?
I use virtualenv and this is result of pip freeze:
Django==1.4.3
South==0.7.6
argparse==1.2.1
wsgiref==0.1.2
yolk==0.4.3
First of all i googled and dissabled south tests with SOUTH_TESTS_MIGRATE=False and SKIP_SOUTH_TESTS=True in my setting.py but nothing changed
SOLVED: Solved when I install django-nose

You can choose app for which you whant to run test:
python ./manage.py test <my_app_name>

Related

ImportError when using heroku for my django web

I checked django is installed properly and in my 'requirements.txt' I wrote 'Django==3.2.3'. However, I cannot use this code:
heroku run python manage.py migrate
So I checked this code:
python manage.py migrate
and found out it worked properly. I know that there are existing questions and read many of them, but I think I have tried everything I could do. I would be really grateful if someone can solve this problem.
your question isn't clear tbh.
install all the dependencies by using the pip freeze command and try to run your heroku commands in the heroku bash available in your heroku dashboard
to run the commands on your heroku machine from your CMD, then command is
heroku run bash --app your_app_name
then you can run whatever command you want.
but I am not sure what is the exact problem you are having.

PTVS Django Data Base Migration

Im testing Python Tools For Visual Studio, I create a django project, make a SyncDB and install django admin with no problems, but now Im trying to make Data Base migration like: Django 1.7 Migrations. the point is that i cant figuer out how to do that. I serched in google and find this: How to run django database migrations with PTVS?. So the migration command is not wraped. I tried using Windows Command Prompt and install C:\Python34\;C:\Python34\Scripts; PATHS but when i type a django command like python manage.py runserver appears No module named 'django'. It seems that i am not pointing to my django project virtual env, but i dont know how to do that.
Execute command in my django app env path does not work neither.
Image:
Thanks a lot!
Before using of virtual env you should activate it. Execute env\activate or env\bin\activate. Not a windows guy so I'm not sure which path virtualenv uses on Windows :-)
You have to activate virtualenv. Go to env/Scripts directory and run activate.bat. Then go to your main project directory and try again python manage.py runserver. If you still see No module named 'django' make sure that django is installed in this environment try pip install django.

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 Buildout to Virtualenv

beginner Django developer here.
I started a personale project with buildout and now I wanted to test some deploying, I decided to go with heroku, but I immediately noticed that heroku works with virtualenv and a requirements.txt file. My question is, is there a way to deploy a buildout project to heroku or convert said project to use virtualenv? If yes, how can I achieve this?
Thanks
Buildout and virtualenv can work just fine together.
Upload your buildout.cfg, your bootstrap.py and use the virtualenv python to run the bootstrap.py script.
Kenneth Reitz (of requests fame, and Heroku's Python guy) has created a buildpack that does just that.

How to call ipdb when a test fails in django testing?

I would like to start ipdb every time a test fails.
I tried
$ ipython manage.py test myapp --pdb
but doesn't works.
If you pip install ipdbplugin and pip install django-nose, then add django_nose to your INSTALLED_APPS and set TEST_RUNNER = 'django_nose.NoseTestSuiteRunner', you can then call:
./manage.py test --ipdb
or
./manage.py test --ipdb-failures
See https://github.com/flavioamieiro/nose-ipdb and https://github.com/django-nose/django-nose for further details.
You'll need to install the nose
and django-nose packages. After you configure django-nose for your project, the default test runner and test management command will be beefed up with the nose test runner supports.
Here's a gist with the output of the python manage.py help test command that shows the impressive list of options you get for running tests after the setup.
You can use the django-pdb app. Only install in your settings project