django github problem

Asked 2 years ago, Updated 2 years ago, 53 views

I finished solving the GitHub domain, but css was not applied I want to ask you a question!

Enter your address through web hosting If you come to index.html, it doesn't come out normally as you can see in the picture below How can I make the css come out properly?

If you run django server cmd and connect it, css works.

django github css

2022-09-22 14:55

1 Answers

Can't. Why? Unfortunately, you used the Github domain to host Github Pages.

It is not possible to host a Django site on Github pages. Github pages is for static sites, whereas Django requires Python to generate pages dynamically.

It is impossible to run a Django site with Github Pages. The GitHub page is for static sites, because Django needs to dynamically create pages with Python.

Maybe you should host a virtual server like PythonAnywhere, Heroku, AWS Lightsail, or get a raspberry pie at home and launch your own server.

A very peripheral answer that is almost useless at this point: CSS is not coming out because the path where the CSS file is stored is not currently recognized by this hosting as the public path for this project. For example, if the STATIC_URL value of static in the Jango project setting now is mystatic, the code://localhost/cs.css.css file will be normal when accessed after django server run. This is because Janggo dynamically provides the project path/mystatic/css.css file as a localhost/css.css file. However, if it doesn't work, you'll have to force the file to access http://localhost/../mystatic/csss.csss to obtain it. (In theory and probably not in practice.)


2022-09-22 14:55

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.