I am working on a Python/ Django project, using Git to manage my version control.
I recently made some changes on a branch called conceptCalendar3
, and the changes I made broke my site.
I committed the changes to that branch, and then checked out master
, which, I had branched from in order to create the conceptCalendar3
branch. However, when I now to try to view my site from the localhost
, on master
branch (on which I have not made any changes since it was last working), I now get a message in the browser telling me that:
This site can't be reached
localhost refused to connect
The Python console is displaying a lot of output with error messages that I've not seen before:
File "/Users/.../Documents/Dev/moonhub/moon/moon/urls.py", line 27, in url(r'^costing/', include('costing.urls', namespace="costing")), File "/Users/.../.virtualenvs/moon/lib/python2.7/site-packages/django/conf/urls/ init .py", line 52, in include urlconf_module = import_module(urlconf_module) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/ init .py", line 37, in import_module import (name) File "/Users/.../Documents/Dev/moonhub/moon/costing/urls.py", line 2, in from . import views File "/Users/.../Documents/Dev/moonhub/moon/costing/views.py", line 2900, in from projects.views import get_project_folder File "/Users/elgan/Documents/Dev/moonhub/moon/projects/views.py", line 38, in from .forms import * File "/Users/.../Documents/Dev/moonhub/moon/projects/forms.py", line 1207, in class PostDepMeetingForm(ValidatedForm): File "/Users/.../.virtualenvs/moon/lib/python2.7/site-packages/django/forms/models.py", line 257, in new raise FieldError(message) django.core.exceptions.FieldError: Unknown field(s) (meeting_date_time) specified for Survey
The 'field' that it seems to be complaining about, meeting_date_time
is one that I added on the conceptCalendar3
branch- but it doesn't exist in the code on the master
branch...
I have tried running git pull origin master
to ensure that I have the latest version of code from the live version of the project, but this tells me that everything is up-to-date.
So why can't I view a version of my site locally, and why am I getting these errors in the console?
Edit
I tried checking out an old commit, and at one point was in a detached head
state- could it be that I am still in this detached head
state, and so some of my code is point to master
, but some of it is pointing to conceptCalendar
? If that's the case, how would I check, and how would I resolve it?
Possible causes:
(Git) You forgot to git add
files in the conceptCalendar
branch, and they are still lying around when you checkout
master
.
(Python) You have stale .pyc
files in your project. Remove them.
(Django) You forgot to makemigrations
in the conceptCalendar
branch
(Django) You ran migrate
on the conceptCalendar
branch, your database schema has changed, but now the code on master
reflects the old schema. Rebuild your database, or migrate backwards.
I'm betting my money on this last point. From the error you posted, i'm thinking that maybe a Form
is extending ModelForm
for a Model
that changed in the other branch. Check that all fields exist in the underlying model, and in the database.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.