Unit Test warning when migrating from 1.5 to 1.7 - django

I have migrated my project from Django 1.5.1 to 1.7.
I have removed South from the installed apps. But when I execute the runserver command, I am getting the following warning, even though I have not written any unit test in the project.
Some project unittests may not execute as expected. HINT: Django 1.6
introduced a new default test runner. It looks like this project was
generated using Django 1.5 or earlier. You should ensure your tests
are all running & behaving as expected. See
https://docs.djangoproject.com/en/dev/releases/1.6/#new-test-runner
for more information.
How can I remove this warning message?

Place this into your settings.py:
TEST_RUNNER = 'django.test.runner.DiscoverRunner'

Related

compiled django application fails to run ASGI channels

I'm building a django application using Pyinstaller.
When I run the application i get an error from dapne server.
"daphne\server.py:13: UserWarning: Something has already installed a non-asyncio Twisted reactor. Attempting to uninstall it; you can fix this warning by importing daphne.server early in your codebase or finding the package that imports Twisted and importing it later on."
In addition, when I compare the console log of the EXE application and a regular run of the django application I notice the following difference.
In the regular run which works as expected I see the following print:
"Django version 2.1.5, using settings 'cfehome.settings'
Starting ASGI/Channels version 2.1.5 development server at http://0.0.0.0:8000/"
however, when I run the application from the EXE I see:
"Django version 2.1.5, using settings 'cfehome.settings'
Starting development server at http://0.0.0.0:8000/"
Appreciate any lead to understand this behavior and ways to fix it.
I know this is old but for others seeking answer. There's a simple fix:
Before importing raven in settings.py, import daphne.server So, your settings.py will look like this:
import daphne.server
import raven
For further information you can read: https://github.com/django/channels/issues/793
I hope it will help.

how to work with south in django

I am trying to learn about python-django web framework.
I have successfully installed database migration tool 'south' in my ubuntu os and also added it to INSTALLED_APPS for using this tool for my web app.
When I run any command using manage.py like
$ ./manage.py runserver
I get this error:
"/usr/local/lib/python2.7/dist-packages/South-1.0.2-py2.7.egg/south/db/generic.py:9: RemovedInDjango19Warning: The django.db.backends.util module has been renamed. Use django.db.backends.utils instead.
from django.db.backends.util import truncate_name
There is no South database module 'south.db.sqlite3' for your database. Please either choose a supported database, check for SOUTH_DATABASE_ADAPTER[S] settings, or remove South from INSTALLED_APPS."
I don't understand what it means. How can I fix this error?
Please give your useful suggestion to solve this error.Thanks
Firstly, you appear to be using the development version of Django. Don't do that, especially as you're just beginning. Use the latest actual release, 1.8.
Secondly, since 1.7 Django has included built-in migrations. There is no need to install South.

Rspec-rails drops migrations after running

Upgrade from Rspec 2.x to 3.x, in a rails project - using Rails 4.1.x.
I'm getting a really odd behaviour happening when I run RSpec. Here is the order of events.
Both test and normal environments are fully migrated. I test it.
I run rspec with command $ rspec
Then I can check my migrations , and this is the result (for test only, production does not think it losses migrations):
I can't understand why this drops all my migrations. Maybe it will also help to say: if I try to migrate on test again I get this error:
So first, why would it drop all migrations? It's not ACTUALLY dropping them, they are still there - since the tables are all still there.
[1]:
Rspec 3 has a new feature that leverages updates in rails 4.1+ that automatically keeps the development and test schemas in sync. So this means that if you already ran your migrations in development, you don't need to run them again with RAILS_ENV=test. You can double check that you have this (Rspec 3 default) feature activated by looking in rails_helper.rb and seeing if you have ActiveRecord::Migration.maintain_test_schema! set.

Can't start Django 1.7.1 development server

I migrated my Django app from 1.4.3 to 1.7.1
I got it working for a short while
but now every time I try to run the development server it gets stuck on:
C:\Users\DAVID\Documents\TinyTap-web\tinytap>python manage.py runserver
Performing system checks...
System check identified some issues:
WARNINGS:
?: (1_6.W001) Some project unittests may not execute as expected.
HINT: Django 1.6 introduced a new default test runner. It looks like this project was generated using Django 1.5 or earlier. You should ensure
. See https://docs.djangoproject.com/en/dev/releases/1.6/#new-test-runner for more information.
System check identified 1 issue (0 silenced).
the localhost is not working , also tried with other IP/ports = same results.
I could get rid of this warning by adding TEST_RUNNER = 'django.test.runner.DiscoverRunner' to the settings file, but still development server is not running
Apparently it was related to migrations and "CircularDependencyError".
After deleting the database , and the migration folders and running manage.py migrate
I was finally able to runserver
Trying creating a new project
django-admin.py startproject mysite
If it works then there's problem with the current project you're trying to run. (You'll need to give us more information for us to help)

Can a older version of django project work on higher version?

I have a django project version 1.4 Is it possible to upgrade it to higher version so that it still works. Should I start the project again from scratch. Is so what are the steps? Is the a proper documentation of django for deployment of the project in windows.
You're right, the django migration is something not very documented.
In my opinion, the best thing you can do to be quick and secure, is:
Check all the major changes between Django 1.4 and 1.7 (look for changelog and Djang website).
Take a look to your code to be aware of what part will be obsolete after the migration.
Do the migration, in a non-critic environment of course. For this purpose, don't touch to your code first, just upgrade the Django version
Fix your code until it works perfectly (run unit tests if you have some).
You're ready to do the migration in a production environment.
I did it between Django 1.6 and Django 1.7 (and migrating from Python 2.x to 3.x in the same time). It was easier than I had imagined. However, Django 1.4 to 1.7 could be a little bit longer, but nothing hard.