I recently started learning as a way of setting foot in python programming. I've been facing problems with URLs since I'm a beginner. So I've been doing this signature verification web app. I'm not facing major problems except when it comes to URL patterns. When I enter the localhost address and the port and execute the program, it displays this error displayed here. I've gone to the URL files on Django and I see no errors on the code that I've written and also on the main folders URL. Can someone help me find the problem or what I'm doing wrong by checking the images and telling me? Thank you to all the people who checked this out.
You have to change
path('Main', include('Main.urls'))
to
path('', include('Main.urls'))
What you did is the Main.urls will always be prefixed by Main ex: localhost:8000/Main
Related
Goal: I want to send the result of a <script> tag in HTML to a server of any kind.
I am working with the Spotify authorization API for a project and one of the required keys is contained in a query string at the end of my app’s redirect URI. I need to get this key.
My solution is to set the redirect URI to a redirect page. Then, on the page, automatically run a script that gets the current URL and send it to my Python script for use. If there’s another way, please tell me, because I’m pretty stuck.
However, to send variables between HTML and Python, I have found I need to use a simple server. Setting this up is the hard part. I’ve made Java, Node.js, and Python servers, but nothing seems to want to work with the <string> tag, and I’m doubtful something like this would even get the actual output of the script.
Is there a way to do this? This is a pretty long question and I apologize, and it should probably be noted I’m a beginner so an explanation and code examples would be nice. Thank you to anyone who reads this!
I am trying to log into a site,
https://www.telenor.no/privat/minesider/logginnfelles.cms?skin=telenor, with my user credentials. That site then redirects to https://www.telenor.no/privat/minesider/minside/minSide.cms.
I have tried all the different propsed solutions that I have found, but nothing has worked so far.. Is there someone out there that has a solution? Would be greatly appreciated!
Not sure how your attempting to log into the website, but here's an article that shows how it's done in python. Maybe post your code on here so we can get an idea of what's going on.
How can I login to a website with Python?
This is first question here and I will try to follow the guidelines to the best of my understanding. ( Also, English is not my first language )
I made a little project using Django, a job search website and i'm running it with DEBUG set to True ( not advised I know, but I wanted to know the cause if anything went wrong )
The admin section and homepage ( and another one ) are working correctly, but the search page gives me a 400 error page. Bad Request (400).
The only difference with the other working page is that the search contains a form. The "heroku logs" doesnt give more detail about the error. Any advice about where I should look for the cause of the problem ?
Everything works correctly locally, I only get the 400 error once it's pushed on heroku. Help ?
As requested, Here are the urls of the search page:
url(r'^search/$',search,name="job-search"), #I use this to collect the search parameter
url(r'^search/(?P<domain>\w+)/(?P<level>\w+)/$',results,name="job-result"), # **Where the 400 error happens** , this is the result page
Make sure your method has some decorator that prevents access to it, like: #ajax_required
I'm making a python script that should zip a file and upload it at a site. My problem is I can't figure out how to login into the site to then upload the file in question.
I've searched trough the web but can't make any of the solutions presented online to work, probably because I don't understand most of them (my knowledge of cookies is quite limited).
The site in question is CurseForge. If anyone could point me into the right direction, it would be great.
You can check this variant of httplib2 http://gnu.gabrielfalcao.com/bolacha/#uploading-a-file , it has examples on that page. You can get the code from http://github.com/gabrielfalcao/bolacha/tree/master
I ended up solving the issue using Requests.
I am working on a Django project for a company. This project worked very well before today.
Today I found a page can not show images (and their corrsponding links). I checked source code of THAT PAGE, I found there are images and links, I just can not find them on the page.
I checked the auth of the server and I am sure I can write things to the database. In fact, I think it is not database mistake because I can find what I want in the page source code, I just can not find them on the page.
Oh my Gosh, I am going to be crazy...
Has anyone suffered similar problem? What kind of problem could it be?
Please help me! Thank you very much!
PS: I can not provide any source code of the project because some business limit...I am really sorry...
Try exploring the site_media directory. If you're images are being served up as static content it could be related to the permissions of that folder on local disk or based on the settings.
Within your urls you may have something similar to:
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': '/path/to/media'}),
OR it may reference the path in the settings file something similar to:
STATIC_DOC_ROOT = '/path/to/media'
If the link looks correct for the image, but the side is not rendering the image even directly your issue will be somewhere in these areas.
For more information check the django docs:
http://docs.djangoproject.com/en/dev/howto/static-files/