unexpected change

16 views
Skip to first unread message

rbarh...@gmail.com

unread,
Aug 31, 2020, 12:36:16 PM8/31/20
to Django users
this says that it can't find "polls/index.html" but it is there...this was working previously.  I don't know what changed.


```
def index(request):
#return HttpResponse("I have a BIG present for you.")
latest_question_list = Question.objects.order_by('-pub_date') [:5]
#output = ','.join([q.question_text for q in latest_question_list])
template = loader.get_template('polls/index.html')
context = {'latest_question_list' : latest_question_list,

return HttpResponse("You are looking at the results of question %s."
```
this has a double folder structure so I tried stating the exact path but that didn't work either.

Kasper Laudrup

unread,
Aug 31, 2020, 12:59:12 PM8/31/20
to django...@googlegroups.com
Hi rbarhydtsf,

On 31/08/2020 18.36, rbarh...@gmail.com wrote:
> this says that it can't find "polls/index.html" but it is there...this
> was working previously.  I don't know what changed.
>

Not that it might help you right now, but it is usually a good idea to
keep your things in revision control (e.g. git) and then commit often.
Especially when you have something that works and want to experiment
with something new.

That way you can easily see the differences between the state of the
code when it worked and the current broken state or use something like
"git bisect".

Kind regards,

Kasper Laudrup

rbarh...@gmail.com

unread,
Aug 31, 2020, 1:05:08 PM8/31/20
to Django users
here is the file structure.
```
polls
    migrations
    templates
        polls
           index.html

rbarh...@gmail.com

unread,
Aug 31, 2020, 1:34:31 PM8/31/20
to Django users
Found it.  Thank you.

On Monday, August 31, 2020 at 9:36:16 AM UTC-7 rbarh...@gmail.com wrote:

rbarh...@gmail.com

unread,
Aug 31, 2020, 2:21:35 PM8/31/20
to Django users
Thank you, Kasper.  Good idea.  Sadly, I don't really know how to do that.

Kasper Laudrup

unread,
Aug 31, 2020, 2:58:11 PM8/31/20
to django...@googlegroups.com
Hi rbarhydtsf,

On 31/08/2020 20.21, rbarh...@gmail.com wrote:
> Thank you, Kasper.  Good idea.  Sadly, I don't really know how to do that.
>

I would recommend finding some tutorial on how to use git (as that is
probably what you'll use anyway). Cannot really recommend anything
specific, but someone else might be able to.

It takes some time to learn even the basics and it might seem useless as
it is time not spend on writing code, but it can save you so much time
later on, so it's definitely worth it.

Has helped me many times in frustrating situations like the one you have
right now, and you will have situations like that again, even after many
years of writing code.

We're only humans after all and most of us cannot remember the point of
the code we wrote two days ago, so it's extremely helpful to have tools
to help you remind you what you did (and why) two years ago.

Kind regards,

Kasper Laudrup

rbarh...@gmail.com

unread,
Sep 3, 2020, 12:10:42 PM9/3/20
to Django users
Yeah, well great advice.  Too bad I didn't take it sooner.  I lost two weeks of really hard work because I move a folder and somehow it erased all the coding I had done in PyCharm.  I don't understand it, but there it is.  I am in the process of learning how to use Git and Github.  But.  Damn.

Shaheed Haque

unread,
Sep 3, 2020, 12:41:27 PM9/3/20
to django...@googlegroups.com
Sorry to hear about your problems. One other avenue to possibly explore is Pycharm's "local history" facility. This keeps track of changes independently of any VCS such as git.

It seems to be based on the original file paths. So, try creating one file with the EXACT path before the rename. Then go into the local history viewer. If you're in luck, you can try to recover the missing content. If that works, try the other files. 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b5a51ad7-d4e1-4fa4-8ee2-cff352bcde13n%40googlegroups.com.

Shaheed Haque

unread,
Sep 3, 2020, 12:45:05 PM9/3/20
to django...@googlegroups.com
To clarify, try creating an empty file (e.g. using the "touch" command) with the right path. 
Reply all
Reply to author
Forward
0 new messages