Django webpage loading issue - python

I'm creating a project in Django, my admin section is working properly, and models are working properly but when I'm going to open the server to check the landing page, it shows like this attached below.
I've created another page and made that page the main landing page but that showed me the same result. Don't know what to do now.

if you create new app in Django . You need to introduce the new path to the Django framework so that the desired page is displayed in the output.
To introduce the new route, refer to the main URLs file of the app and use include:
path('', include('app_name'))

Related

Is there any way to add a button in PyWebIO that can go to another page of the website?

I am making a simple website to show the capabilities of PyWebIO, which I am using with Flask. I have one question regarding PyWebIO + Flask. I know that there is a put_button() feature, but is it possible to make it have a relative link to another page on the site, just like how the HTML About can be used for a relative link. Is this impossible to do, or have I just not found how to do it yet?
Ideally, I would have a button that links to a /sql page on the website. Each pyWebIO app is a webview on its own route, so /sql goes to my SQL app, and / goes to my home app, which is supposed to have links to all of the other applications made using pyWebIO.

Django working with external HTMLs

I am writing a small Django local project (with no access to internet). Let's say i have offline standalone version of Wikipedia(I believe it's HTML5 format) as that: .
I am trying to write a simple Django front page where user would be able to click a button and be redirected to "wikipedia_for_schools/index.html" from where all the url control will be done by that offline wikipedia stand alone page.
How is it possible to make? :/ I have tried creating a link in django template as
Click to see wikipedia
but that doesn't work cause Django complains that "http://172.30.10.67:8000/modules/wikipedia_for_schools/index.htm" Page not found, my urls.py is just
urlpatterns = [
url(r'^$', views.IndexView, name='index'),
and i think it's impossible to rewrite each file from wikipedia offline project to Django MVT model to provide urls, models and templates for each link.
That's how my Django project structure looks like:
And that's how offline Wikipedia index page looks
Any help would be highly appreciated
Standalone HTML pages are static files, and should be stored in the static folder and accessed via /static/.

Can I Use One view In a Django Project?

I´m new to web dev,
and I was wondering if it´s possible to make a website, that just need to present information of a company (HTML), in just one view.
Like rendering the entire bootstrap in one view.
Yes, you can serve your HTML code through a TemplateView.
So if your entire single page application sits in home.html you could definitely do this. But there is no point in using Django for only that purpose. You would rather want to serve your static HTML page from a classic web server like nginx or apache.
I don't know why would you want to do that.
You can use different html files which will be served as your website templates. You can also extend the files using a simple base.html file. This will help you if you want to open other links when people click on different links on the website.
See this example: https://github.com/singh1114/Djangosite/tree/master/duggal/webportal/templates/webportal.
For using this you have to know more about views and urls.
For making scrollable things, you need to know the concept of ids in HTML.
For example
http://yoursite.com/#your_name will try to find id your_name in the HTML. This way you can create scrollable things.

Bottle python web framework ,style sheet is not referenced in template

I have two question from bottle python web framework
Question 1. In my website http://localhost:8080/home
i am browsing via browse button to fetch excel file.i will process
excel file i want to show the data in same
http://localhost:8080/home page.
But when i google, they asked me to create template.
Do we have only option to go for template or any possibility to
display in the same home page
Question 2:
I created template file and able to show results in the template but
i style sheet is not reflected in the template.
i tried href =/static/style.css i tried href
=/app/static/style.css i tried like URL get_url('static',
Thanks Mani.
Well, If you are rendering anything, you definately need a template. Of course, you can create this template in a flexible way, but it's up to you.
When it comees to the second question, the url should be put in quotation marks. Compare

Use of Stripe payment gateway in django

I have installed dj-strpe module and register one user without any difficulty i.e., by submitting the form at /payments/ and here dj-stripe register the current user to stripe.com . But what if I want to send card information with the user and want to use it later , However I register the card by following instructions https://stripe.com/docs/tutorials/forms .
But I think this module must contain all this forms already but I don't found any thing in documentation to use them (how ever I find out urls and forms in this module) . So please tell me how I can use those forms in my project , is there any specific tags or urls to submit the forms.
For one instance I used this url /payments/history/ but I didn't show any thing in browser however I have checked the browser console and in response there is some html but browser is blank.
I hope I have explained my question. Any help will be appreciated.

Categories