Closed enewe101 closed 9 years ago
Ok, the app is ready for upgrading to Django 1.7. Next time you commit to the branch your working on, checkout master and go do the upgrade instructions below. Afterward you can go back to your branch, merge in master, and continue working using Django 1.7 (as explained below). Here we go:
$ git pull
$ git checkout master
src/digidemo/settings.py
and delete or comment the line FIXTURE_DIRS = (os.path.join(PROJECT_DIR, 'data/fixtures'),)
. That should be around line 114, although our settings files can differ somewhat.$ sudo pip install Django --upgrade
mysql> drop database digidemo; create database digidemo;
then exit mysqldigidemo/src
run $ python manage.py migrate
digidemo/src
run $ python manage.py test
If the tests went well, you can go back to the branch you were working on, merge in master, and continue working, like this:
$ git checkout branch-you-were-working-on
$ git merge master
Post here if you run into problems!
live server now running django 1.7.5
I ran into a problem with Languages
on lines 103 and 104 of my settings.py file and had to remove the _
from before ('English')
and ('French')
to get my database to sync.
@mlhuish -- Ah shoot -- my bad. I forgot to include some of the new settings in the settings.template
file. Hmm.. It has always been difficult when making changes to the settings file, because it's not version-controlled, only the settings.py.template
file is, and this makes syncing settings.py
with settings.py.template
a human job, which is error prone.
I think I can make that problem go away. Could you try the following?
cp settings.py ~settings.py
local settings
local_settings
This will overwrite your settings file (that's why we made a backup). Git might complain when you try to checkout local_settings
, because it doesn't want to overwrite your settings file. If so, just delete the file (be sure you made your backup!)local_settings.py.template
. Copy that in place, removing the .template
part. Open it up, and insert your PROJECT_DIR
setting and your DATABASES setting. That should be all you need to do.This should greatly simplify things, because all of the machine-specific settings are extracted into a non-version controlled file, while the rest of the settings are version-controlled.
Hey @enewe101 Thanks for this! Unfortunately, there were 17 errors and 1 failure after running the test and the site was not loading properly - no static files. However, when testing the site manually on the development server the site loads beautifully and seems to be functioning properly. Do you think there be a problem with my test.py file or is this a settings issue ?
On Mon, Mar 2, 2015 at 3:37 PM, enewe101 notifications@github.com wrote:
@mlhuish https://github.com/mlhuish -- Ah shoot -- my bad. I forgot to include some of the new settings in the settings.template file. Hmm.. It has always been difficult when making changes to the settings file, because it's not version-controlled, only the settings.py.template file is, and this makes syncing settings.py with settings.py.template a human job, which is error prone.
I think I can make that problem go away. Could you try the following?
- commit your work.
- Back up your settings file cp settings.py ~settings.py
- Pull the latest from the repo. You should get a new branch called local settings
- checkout local_settings This will overwrite your settings file (that's why we made a backup). Git might complain when you try to checkout local_settings, because it doesn't want to overwrite your settings file. If so, just delete the file (be sure you made your backup!)
- Your new settings file will should need to be changed by you. You'll notice that there's a new file called local_settings.py.template. Copy that in place, removing the .template part. Open it up, and insert your PROJECT_DIR setting and your DATABASES setting. That should be all you need to do.
- Run the tests and let me know what happened.
This should greatly simplify things, because all of the machine-specific settings are extracted into a non-version controlled file, while the rest of the settings are version-controlled.
— Reply to this email directly or view it on GitHub https://github.com/enewe101/digidemo/issues/54#issuecomment-76813809.
also when I try to run python manage.py collectstatic It says the following...
You have requested to collect static files at the destination location as specified in your settings: /home/ange/projects/digidemo/digidemo/src/home/ange/projects/digidemo/digidemo/static
Which is totally not the correct directory. It seems to be merging BASE_DIR with STATIC_ROOT.
Hmm. I think there's a settings problem and maybe a fixtures problem too (fixtures contain the test data, and if the test data is different than what's expected, it causes tons of errors).
Let's start with settings. Could you send me your settings.py
and local_settings.py
-- maybe just email them to me?
Sorry about the trouble btw, and thanks for trying all these things!
Hey guys, I think everyone is up to speed with Django 1.7 now. I'll close this issue, but if you have trouble you can reopen it.
We've been putting off the upgrade to Django 1.7 (the latest version), because upgrading breaks the app. But now is probably a good time, because we need one of the features introduced in 1.7: migrations.
Migrations are used when changes are made to models, in order to apply those changes to a database that already has data. Migrations tell the database how to to make changes to its structure while preserving the existing data.
Now that we have a live server, and are finding the need to evolve our models, it makes sense to go ahead and migrate.
To make the app work with 1.7, a very small change needs to be made to how the test data fixture is loaded during testing. You'll need to toast your database and rebuild it after upgrading. I'll post instructions in this issue soon. It should be possible for the code base to be compatible with versions 1.6 and 1.7 while we make the shift.