I changed the title in html and added a favicon, and those changes are only showing up locally. This is happening even when I have updated some text ("Testing 1 2 3" as shown):
However, when I update to github and push to heroku, I the text changes happen ("Testing 1 2 3") but the title and favicon don't show up:
I am also using incognito, so it can't be a problem with the cache, and I have the same problem on Firefox so it can't be the browser. What could the problem be?
Here is part of my html code:
<html>
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
<head>
<title>
Opal Kale
</title>
<meta name="description" content="Senior at Cal studying CS. Welcome to my personal homepage.">
<meta name="keywords" content="Opal Kale">
<link href='{{url_for('static', filename='style.css')}}' rel='stylesheet' type='text/css' />
<link href='http://fonts.googleapis.com/css?family=Codystar:300,400' rel='stylesheet' type='text/css'>
</head>
<body id='home'>
To expand on what Kapil said, this isn't a problem with your code at all, but with your domain host. You registered your domain with one company, but your Heroku app runs on another domain.
You're using cloaked redirection to point your URL at Heroku. This means your domain registrar isn't doing any DNS changes, but just creating a page with a frame inside of it that displays the contents of the other url.
You can see it if you curl the page:
>> curl http://www.opalkale.com/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<meta http-equiv='content-type' content='text/html; charset=UTF-8'>
<meta name="VERSION" content="">
<meta name="DATA" content="fwdnode7-bl.web-hosting.com (162.255.119.4)">
<title></title>
</head>
<frameset rows='100%, *' frameborder=no framespacing=0 border=0>
<frame src="http://glacial-mesa-9513.herokuapp.com/" name=mainwindow frameborder=no framespacing=0 marginheight=0 marginwidth=0></frame>
</frameset>
<noframes><h2>Your browser does not support frames. We recommend upgrading your browser.</h2><br><br>
<center>Click <a href="http://glacial-mesa-9513.herokuapp.com/" >here</a> to enter the site.</center>
</noframes>
</html>
This method works, but it's a really cheap n' dirty way to do it. Your registrar has no idea what the content of that other page is, so that's why the title, favicon and anything else won't display properly.
The right way to do it is to have your domain registrar point the URL at heroku's servers using DNS, but a lot of free domain registars won't do this.
The source code on the site indicates that the html body is being rendered in a tag that points to the heroku server. So the correct body is being rendered. But the header being rendered is the header on.
The title and favicon you wrote are being rendered in the tag in the frame, but the outside the doesn't have the favicon or title tags, and that's the one the browser is reading.
I'm not sure what might have caused this, but your DNS / hosting settings are likely the thing to blame.
Related
Its weird but I removed everything in the css file, the website still shows all the colours and stuff. I dont know what happened so I need t ask for help.
here is the main html:
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link href="css/animate.min.css" rel="stylesheet">
<link href="css/bootstrap-dropdownhover.min.css" rel="stylesheet">
<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='style.css') }}">
</head>
the style sheet:
(yes its literally nothing)
I'm running flask and I dont know whats happening so..
also the screenshot for the webiste when I put all the styles in:
would be happy if anyone can help me get past this part
Likely, your browser is caching the CSS. If you are in Google Chrome, a longer-term solution while developing is to open the DevTools (Ctrl+Shft+I), go to Network/Disable Cache and then hit the "open to new window" button so you can minimise it.
I am trying to login a website using Python, but in the html source code which I got for urllib doesn't contain a form to login and I have checked by chrome, it also shows the same html code.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>cApexWEB 1.1</title>
</head>
<frameset border=false frameborder=0 framespacing=0>
<frameset>
<frame name="main" src="capexmain_middle.htm" scrolling="no" target="_top">
</frameset>
<noframes>
<body>
<p>This page uses frames, but your browser doesn\'t support them.</p>
</body>
</noframes>
</frameset>
</html>
Some modern websites use dynamic content loading to load login forms from external authentication services. You may use Selenium to simulate a browser and bypass this problem. You find a detailed introduction and explanation here.
I'm creating a simple page using python 3.4 and generating HTML. However the stylesheets don't load. Here is my code:
`#!/Python34/python
content ="""<html>
<head>
<meta charset="utf-8">
<title>Spain National Team</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<!---Body Stuff--->
</body>
</html>"""
print(content)`
Checking the source of the webpage,it's a well formed HTML document, but the styles don't load. My python script and css are in the same directory:
xampp/cgi-bin/sports/index.py
and
xampp/cgi-bin/sports/styles.css
If you want to open it on your default browser,
import webbrowser
content ='<html>\n<head>\n<meta charset="utf-8">\n<title>Spain National Team</title>\n<link rel="stylesheet" href="styles.css"/>\n</head>\n<body>\n<button></button>\n</body>\n</html>'
html_file = open('sample.html', 'w')
html_file.write(content)
flnme="sample.html"
webbrowser.open_new_tab(flnme)
As the title says, only the first static file in a Django template is loaded.
Here is the offending code:
{% load staticfiles %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{% block title %}{% endblock title %}</title>
<link rel="stylesheet" href="{% static 'global/css/grid.css' %}" media="screen" title="grid" charset="utf-8">
<link rel="stylesheet" href="{% static 'global/css/style.css' %}" media="screen" title="main" charset="utf-8">
</head>
I have 'global' set up correctly in my STATICFILES_DIRS, both 'grid.css' and 'style.css' exist in that directory, and both styles do not conflict.
But only 'grid.css' loads when I render a page with the above code in it.
When I check inspect element in chrome, both links are displayed/rendered correctly:
<link rel="stylesheet" href="global/css/grid.css" media="screen" title="grid" charset="utf-8">
<link rel="stylesheet" href="global/css/style.css" media="screen" title="main" charset="utf-8">
But when I check the 'Sources' of chromes dev tools it shows the folder 'static/global/css', and within it only grid.css is displayed. So Django is not delivering style.css in the response.
I know that style.css works, when I comment out the line that loads grid.css, style.css does load.
So again, it seems that only the first static file that is requested in a template is delivered in the response.
It's the HTML attribute 'title'. When that is set on a stylesheet link, then that stylesheet will become the 'prefered' stylesheet, and all others will be ignored. I got rid of the title attributes and it worked.
I dont think this is from Django, as far as my knowledge django does not do that.
Clear your cache and try again. Maybe your first CSS file might have been loaded from cache and second file might not be cached earlier.
If both files are not loaded after clearing cache, then there is a mistake in your static file configuration.
If the first CSS comes even after clearing the cache, check the Network Tab in Google Chrome. See where the request goes, and see the response received. Check whether the response comes as the file or 404 or 503 and debug accordingly.
I automatically post adverts for people's jobs on member's facebook pages using Python's facebook module. I have applied for and got Facebook's authority to do this. Now when I post to most people's pages, the image and description are not being scraped, however when I post with the FB site owner's access token of the business site associated with the application, they are.
The code I use to post the pages:
import facebook
graph = facebook.GraphAPI(access_token)
# record the id of the wall post so we can like it
fbWallPost = graph.put_wall_post(message=fbmsg, attachment=fbpost, profile_id=pageID)
Running this in the python shell posts a URL that gets scraped, but running it from within the application it very frequently does not. The page has the following meta tags:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Fair Work</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Fair Work">
<!-- Facebook crawler uses these JRT -->
<meta property="og:site_name" content="Fair Work"/>
<meta property="fb:app_id" content="322643981237986" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta property="og:url" content="http://fairwork.com.au/job/final-job-on-thursday-april-30th/" />
<meta property="og:description" content="My last test today"/>
<meta property="og:type" content="article"/>
<meta property="og:image" content="http://fairwork.com.au/media/cache/cd/b0/cdb05f8dd8885351925bf43076870937.jpg"/>
<meta property="og:image:width" content="400" />
<meta property="og:image:height" content="400" />
The application ID is correct. I go to Facebook's debugger, and I enter the URL
I click on "Debug", and I get an error that the "og:type" meta tag is missing, which it is not as you can see:
I then click on "Fetch new scrape information" ...
...and the image and description are loaded up fine. From this point if I post the link on my site, the image and description display, however all previously posted links do not have the information scraped. The two successive posts of the same link in the next image were done before (bottom) and after (top) running through the debug process mentioned previously:
The page linked to is publicaly available, and served by Django. I want to be able to automatically post the ad's (when this is requested by the FB page owner) and have the image and description scraped by FB on posting. Any ideas?
It seems that NGINX is causing the http calls to the Facebook graph API not to work properly. When
fbWallPost = graph.put_wall_post(message=fbmsg, attachment=fbpost, profile_id=pageID)
is run through Celery (which runs separately to django, and not through the web server), facebook scrapes the posted link and shows the image and description linked to by the OG meta tags. When django runs put_wall_post, the post occurs, but facebook does not scrape the link. Other calls to the API also don't work when run from a Django view. I can only think that NGINX is interfering with the HTTP request in some way.