I am having a django python website in domain.com. I am having a blog in a folder called as fmblog inside my public html. I want to access blog by entering domain.com/blog.
My blog is situated in /home/user/public_html/fmblog
So, I have an alias in my virtualhost configuration like the following.
Alias /blog /home/user/public_html/fmblog/
My issue is that, I am getting the blog when I try to access www.domain.com/blog. I am getting a 404 error when I try to access http://domain.com/blog.
Why is this happening? I know this will be fixed if I redirect every non-www requests to www using a rewrite rule. But I dont want to use that as it have some bad effects in my django website. How can I make my blog live even on non-www queries?
You can make a redirect for the blog only, adding the rule to the .htaccess in the fmblog, above the #BEGIN WordPress line
Related
Recently, I deployed a Django web app. However, when I'm accessing the admin page, I'm not getting the expected interface to add or remove a user from a certain group:
At the of inspecting the page, I'm receiving the following messages:
any idea about how to handle these errros?
Thanks!
Content Security Policies are usually controlled via middleware like django-csp. All the admin control JavaScript files are included as static files, no external libraries should be loaded, they should be on the same domain.
In order for CSP to allow to load these files, you need to add script-src 'self' (it's an alias for same-origin). Look inside settings.py for CSP_SCRIPT_SRC keyword and append 'self' (single quotation marks are required).
Note: if CSP headers are added not by Django, but by reverse proxy, like nginx, then you should look and fix configuration settings there.
Okay, what I want to do seems simple but isn't. Here is what I have and want:
A website created with Flask and Jinja 2: https://www.neuraxio.com/
A documentation website for an open-source library created with sphinx. The output is raw static HTML files: https://www.neuraxle.neuraxio.com/stable/index.html However, I would like to move this website to https://www.neuraxio.com/neuraxle/stable/index.html with redirects from the old subdomain to the new one. The static HTML site is hosted with github pages for now.
I want to create a jekyll blog with github pages because it's simple to manage and create new articles from markdown. Or perhaps a Wordpress blog, but something. I'd like to host that blog under https://www.neuraxio.com/blog/ and not under https://www.blog.neuraxio.com/
I know subdomains are easy to manage from a DNS and hosting standpoint, but I'd like to centralize everything under the same subdomain: www.neuraxio.com.
So, how would you approach solving this problem?
For the static HTML of part 2, it might be as simple as moving the static HTML to a subfolder of the public static HTML of the Jinja 2 theme, except the fact that it might break relative links (?).
For the Jekyll or Wordpress site, I'd like it hosted under a slash of the domain and not a subdomain. How would you approach that?
Thank you for suggesting fixes and various creative ways to approach the problem. If that can be solved simply with the existing Flask and Jinja 2 code, that'd be cool. Or by using strange DNS tricks considering I'm already set up with the hosting of each subsites.
I expect to have relative HTML links errors, however. How should I prepare agains that, too, or automatically fix each link?
I suggest adding a CNAME dns record that can point https://www.neuraxle.neuraxio.com/stable/index.html
to
https://www.neuraxio.com/neuraxle/stable/index.html
This is pretty easy to do thats why I would have just gave you a link if I could but I will write a long answer instead :
1 - Log in to your DNS management service (GoDaddy.com, googlecloud dns service...) For my part, my website is hosted on google cloud DNS.
2- Click on your website.
3- Select Add a Record Set
4- Select CNAME record
5- I the DNS name form add https://www.neuraxle.neuraxio.com/
6- In the canonical name (the alias) add : https://www.neuraxio.com/neuraxle/
I wouldnt put this part /stable/index.html because your server should be abble to take care of pointing to it.
Hope this helps !
I have a site made in wordpress and i´d like to show my django application inside this site. I don´t know how to do that. How do call my django application and show it inside the site.
Your other option - far more work and technical than using an iframe - is to show the content in the WordPress site by using django-rest-framework (on the Django app) then pulling in the content via API requests.
It would be a lot of work, but well worth learning and provide you the most flexibility.
The steps would be
Install django-rest-framework for your Django app
Setup up and configure an API
Either use PHP on the server or JavaScript on the frontend to pull in the content from the API
Only using iframes, because they bore are diffrerent frameworks using different languages etc... so you will make to make one iframe inside your wordpress page and inside that page to load one url from your django application
https://www.w3schools.com/tags/tag_iframe.asp
try to detail your issue. Do you need a link in your wordpress´site ? have you tried loading it using iframe ?
It´s really important to show inside a wordpress´site ?
I have built a website using Django framework(www.example.com). While navigating the site the URL changes to like (www.example.com/home or /profile etc).
Is there some way that the current url is masked by a placeholder eg(www.example.com/home should be shown as www.example.com).
This should work throughout the website.
The url shown to the user would remain same (www.example.com) to where ever the user navigates on the site
HIGHLY NOT RECOMMENDED
Keep a single link in your urls.py, containing r'^$'.
Handle all requests purely as POST request.
Note: You'll have to hard code every parameter, and detect manually from where the request is coming.
To know how to work with POST request in detail check Django docs
I need to do such thing, but I don't even know if it is possible to accomplish and if so, how to do this.
I wrote an Django application which I would like to 'attach' to my wordpress blog. However, I need a permalink (but no page in wordpress pages section) which would point to Django application on the same server. Is that possible?
You can use the "Page links to" wordpress plugin to point to any url: https://wordpress.org/plugins/page-links-to/
There are many ways to do this. You will have to provide more info about what you are trying to accomplish to give the right advise.
make a page with a redirect (this is an ugly solution in seo and user perspective)
handle this on server level.
load your Django data with an ajax call