Why is for loop not working in django html? - python

yesterday i wrote an application using for loop that worked exactly as I wanted it to work, but today when I opened it up without changing a thing it is not working. and this is happening every time I try to make something similar. i also tried inspecting the page but I only see an empty div while there is actually for loop inside it. any help would be appreciated. thanks
I also created new app and did exact same things. i just coppied code and it worked. but when i try to do same in this application it remains the same.

Related

Followed the Haystack tutorial to the "T" but still won't work

I am trying to implement search functionality to my Django web app, and after doing so research it seems as if everyone likes haystack mixed with elasticsearch the most. I've been trying to follow along with the haystack tutorial here:
http://django-haystack.readthedocs.io/en/v2.4.1/tutorial.html
but I am encountering 2 main problems. For one, my terminal is saying I am missing the dependency elasticsearch, and it says this as soon as I add this to my urlconf:
(r'^search/', include('haystack.urls')),
I did every thing the tutorial says to do so I am not sure what the problem is, and it seems like no one else is really encountering this. I redid the whole tutorial incase it was a stupid typo, but I have the same outcome. This still might just be me being incompetent but either way I can't figure it out. The other problem is just me being confused about the search template which is set up near the end of the tutorial. It doesn't explain exactly what it is so I am not sure if this is the input field for entering in the query, or if this is what displays the results for the query or what. It also does not explain how to configure this to your own code. I'm sure I could figure all this out in terms of the template if the project would run and I could do some debugging, but the terminal stops it because of the uninstalled dependency mentioned earlier. Anyways it would be awesome if anybody could help me with this or just point me in the right direction, thanks.

Django 1.5 bug with template "extends"?

I'm trying to figure out what is wrong with my code. As far as I can tell it may be a bug with Django 1.5. I am running on windows. The templates, css, etc.. are being found no problem. Semantically everything is being outputted to source correctly. The problem is some sort of quirk when the browser renders the page, possibly a development server quirk.
The issue is very difficult to explain so I made a video and put it on YouTube. The quirk only occurs if the the template has an "extends" in it.
Video showing the quirk
As you say in the comments, the problem is with chrome as far as I know the Inspect Web code is different from the View Source code, a blog's post about this, maybe this can happen because a chrome's bug or I do not know if Jquery makes and inject or something like this, I do not think that this is a django's bug. So i think that you do not have to worry of all about this.
The answer to this question turns out to be the Visual Studio editor I was using. The html layout page was being saved with BOM turned on. You have to manually turn this off in Visual Studio. Basically it was saving the page in a way Chrome did not understand completely.

email after IDLE exits out of code Restart

I've tried to find some help with online searches and wasn't able to find anything so I'm posting on here and hoping. I've got a bunch of code with 3 "for" loops and a try/except statement inside of the 3rd "for" loop. I run the module from IDLE and it runs fine for about 16 hours then just quits and prints on the IDLE command screen =====Restart====. It does this randomly so I can't replicate it but I've gone through by hand and was able to process the data that it quit on without a problem. Does anyone know of a way to have python email myself when this occurs? I've tried putting the main code inside of a definition and use a
try:
definition
except:
send email
but this doesn't work either. I've got the emailing part of the code working fine. I apologize that I am not including the code here. I've talked to my boss about it, but since it is dealing with sensitive data I'm not allowed to. Any guidance that you can provide would be greatly appreciated.
Thanks

Windmill getPageText function never ends

Some days ago I started a project where I need to create a web scraper. An user suggested me to try Windmill.
Everything is fine but I have a problem: when I call to getPageText() function it sometimes hungs and never ends. I have tried some possible solutions but without success. Besides, I haven't found any information about this problem so I don't know how to proceed.
Any idea?
Try one of these:
client.waits.sleep(milliseconds=12000)
client.waits.forPageLoad(timeout='60000')

use of <$nopage> in python try-except block

I am seeing use of <$nopage> in some python scripts online and in a pdf file. I have googled for what it stands for. But could not get information about it. To be specific, in the PDF version of the book, Core Python Programming, I see this <$nopage> construct many times. But on the online version (Safari Books) of the same book, I do not see this construct. Can someone please tell me what this <$nopage> means? Thanks.
It means nothing in the context of Python at all. It's probably a mistake in the PDF rendering. I'm guessing it's a statement to prevent page breaks in the code.
Update: I finally found an example here:
http://raninho.com.br/~paper/Python/O%27Reilly%20-%20Core%20Python/237.html
That is indeed not python code, but most likely code to prevent page breaks. Pretend it's not there.

Categories