Github Pages - Not been able to deploy - github-pages

Trying to host my personal django based website on github page - but after deployment getting the following on the page -
{% load static %}
{% include 'includes/profile.html' %}
{% include 'includes/about.html' %} {% include 'includes/skills.html' %} {% include 'includes/service.html' %} {% include 'includes/portfolio.html' %} {% include 'includes/blog.html' %} {% include 'includes/testimonial.html' %} {% include 'includes/contact.html' %}
Scoured all the available youtube videos but still stuck.
Thank you so much for helping!!
Tried to host the page but not getting the desired page -

Related

flask url conflicting with href

In my HTML code i have the following jinja template code:
{% for site in sites %}
{{ site.site_name }}
{% endfor %}
The issue is: let's assume that {{ site.site_link }} = www.domainname.com, so whenever the link is clicked it supposed to direct the user to the domainname page. but, it leads to :
http://127.0.0.1:5000/www.domainname.com
which is a 404..Any idea why is this happening and how to fix it?
I don't know if this is relevant, but, I am using flask Blueprints.
You need to put http:// in front of it, like href="http://........"
{% for site in sites %}
{{ site.site_name }}
{% endfor %}

django-bootstrap3: changed theme_url but Bootswatch theme not loading?

I'm trying to use the bootswatch flatly theme. I followed the instructions given on the documentation regarding updating the settings.
I've added the following to my project's settings.py:
BOOTSTRAP3 = { 'theme_url': 'https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/flatly/bootstrap.min.css', }
I've also added the following to my project's base.html template, between the head tags:
{% load bootstrap3 %}
{% bootstrap_css %}
{% bootstrap_javascript %}
{% bootstrap_messages %}
index.html template:
{% extends "base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% bootstrap_css %}
{% block content %}
Hello World
{% endblock %}
However, the theme is not reflected when I reload my index page.
Is there something I'm doing wrong?
Edit: a temporary workaround I've found is to overwrite the css loaded by django-bootstrap3 by adding <link rel="stylesheet" href='https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/flatly/bootstrap.min.css'> to the base.html template file, but I'd much prefer a solution using only django-bootstrap3.
Found out that this is a known issue, and has been fixed recently in the develop branch of the django-bootstrap repository. However, the pip package hasn't been updated yet.
Temporarily fixed this by editing my venv copy of django-bootstrap3.

Django include - using the correct include depending on the page

Hi guys I am fairly new to the Django framework and was hoping someone could assist me in my current dilemma :)
I have my base template set up for my project. I have a main-content area and a side-bar
I created a include for my side bar:
{% include "modules/include/sidebar.html" %}
The issue is that I have two different side bars that I would like to render depending on the page the user is on e.g. if the user is on the home page then use
{% include "modules/include/sidebar.html" %}
but if the user is on an article page then use
{% include "modules/include/article-sidebar.html" %}
I looked through the docs but couldn't find anything to help me solve this issue.
All and any help will be appreciate.
Create a block in your base template, something like {% block sidebar %}{% endblock %}
Then in your home page template do
{% extends 'your-base-template-name-here' %}
{% block sidebar %}
{% include "modules/include/sidebar.html" %}
{% endblock %}
And in your article template use
{% extends 'your-base-template-name-here' %}
{% block sidebar %}
{% include "modules/include/article-sidebar.html" %}
{% endblock %}
More about template inheritance here https://docs.djangoproject.com/en/1.9/ref/templates/language/#id1

Read a file in django and find string in file

i am a new to django, and i'm trying to execute a django code in an html template, but it is showing the same error and i dont know how to make it work. I am trying to read some files and find the one that contains the string. This is the code in the template:
{% if documents %}
<ul>
{% for document in documents %}
{% if 'TheString' in open('document.docfile.url').read() %}
<li>{{ document.docfile.name }}</li>
{% else %}
<li></li>
{% endif %}
{% endfor %}
</ul>
{% else %}
<p>No documents available.</p>
{% endif %}
The error is the following:
TemplateSyntaxError at /subir/
Could not parse the remainder: '('document.docfile.url').read()' from 'open('document.docfile.url').read()'
What could it be, or am i doing it wrong? Thanks in advanced.
Your problem is you are trying to use Python code in the template, like your open() call.
Django templates don't work like that - you can only use a very limited set of syntax, and the syntax is not the same as Python.
Everything inside {{ }} and {% %} needs to be special Django template syntax, not Python code.
See the Django Template language documentation for the full details.
You can't use code like this in a template directly see the documentation for available template tags and filters. From what I can tell by the code you have posted in your view.py you'll need something like this:
docs=[]
for document in documents:
if 'TheString' in open('/path/to/document').read():
docs.append(document)
after passing docs to the template you could do this in the template:
{% for doc in docs %}
<li>{{ document.docfile.name }}</li>
{% empty %}
<p>No documents available.</p>
{% endfor %}
I'd need to look at what you are passing from the view to be sure of this, but I'd gladly assist in further help with further information if this doesn't help.

Django-CMS show_placeholder not working as expected

I'm working on a site where the footer content is shared across all pages. What is the best way to do in Django-CMS?
I tried using show_placeholder tag, but it somehow didn't work. A little more details on what I did:
First, I have a {% placeholder footer_info %} in base.html. Then I add a page called "Home" (template homepage.html) in django admin and put some text under footer_info as a Text plugin. As the accepted answer in this question suggested (http://stackoverflow.com/questions/3616745/how-to-render-django-cms-plugin-in-every-page),
I add
{% placeholder footer_info or %}
{% show_placeholder footer_info "Home" %}
{% endplaceholder %}
In a template called services.html which I used as the template for page Services.
However, the content in home page is not showing up in services page. I also tried adding an id home_cms_page to home page in the Advanced option area, so that I can reference it in services.html like this:
{% placeholder footer_info or %}
{% show_placeholder footer_info "home_cms_page" %}
{% endplaceholder %}
But the content is still not showing up.
Could anyone tell me what I am doing wrong? And is this the best way of getting some content from a page across all other pages (and I have to add show_placeholder in every other page)?
Thank you
EDIT:
It is not a multilingual site. I commented out 'cms.middleware.multilingual.MultilingualURLMiddleware', because the only language I use on the site is English.
I have this in my base.html:
{% load cms_tags sekizai_tags %}
<!-- all the rest of the HTML markups -->
<div class="span4">
{% placeholder footer_info %}
</div>
Then I added a page in the admin called "Home" with a Text plugin and an id of "home_cms_page".
The following is in my services.html:
{% extends "base.html" %}
{% load cms_tags %}
{% block base_content %}
{% placeholder services_info %}
{% endblock base_content %}
{% block page_content %}
Home page
{% endblock page_content %}
{% placeholder "footer_info" or %}
{% show_placeholder "footer_info" "home_cms_page" %}
{% endplaceholder %}
Read the documentation:
If you know the exact page you are referring to, it is a good idea to
use a reverse_id (a string used to uniquely name a page) rather than a
hard-coded numeric ID in your template. For example, you might have a
help page that you want to link to or display parts of on all pages.
To do this, you would first open the help page in the admin interface
and enter an ID (such as help) under the ‘Advanced’ tab of the form.
Then you could use that reverse_id with the appropriate templatetags:
{% show_placeholder "right-column" "help" %}
I added "index" in the advanced options of the index page, and added {% show_placeholder "banner" "index" %} in the base template. It all works.