Solve the problem that django cannot access local static files (js, css, img) and neither js nor cs can be loaded in the web page
1. I downloaded a blog project online today and found that js and css could not be loaded when accessed locally. I think it should be a safety measure for the project to go online, but I want to debug the project. The method is as follows Edit in settings.py Add STATICFILES_DIRS = ( os.path.join(BASE_DIR, ‘static’), ) In addition STATIC_ROOT = os.path.join(BASE_DIR, ‘static’) Change to STATIC_ROOT = os.path.join(BASE_DIR, ‘static1’) That is, the static here cannot be the same as above, change the name. Additional knowledge:When using uwsgi to deploy Django projects under Linux, static files cannot be loaded normally You need to use python-admin to open the django service under Linux. If you are python3, the command should be python3-admin manage.py runserver. You can access the page normally without static loading problems When configuring uwsgi, you need to change the settings in the project settings.py. Change the project as follows debug=False allow_host=[‘*’] Static file relocation STATIC_ROOT =os.path.join(BASE_DIR,”/var/www”) Then transfer the static files in the project directory: Python3 manage.py collectstatic The order of this step is very important, otherwise there will be problems with the path. There are many ways to configure uwsgi. I use the following one. Create a new…
HTML documenthtml,html5,css,css3_html/css_WEB-ITnose
Various HTML tags and simple applications: http://www.w3school.com.cn 1 2 3 Horizontal line 4 Retains spaces and line breaks within tags 5 Computer code 6 7 Keyboard input 8 9 Teletype text10 11 Sample text12 13 Computer variable14 15 Address16 Show abbreviations etc.17 WWW18 19 Delete 20 Insert 21 Bold 22 Emphasis 23 Italic 24 Small font 25 Add Quotation marks 26 Long quotation 27 Link opens in a new window 28 Replace the space mark 1 Space 2 Heading 3 4 Padding 5 Margin 6 bgcolor=”red” background=”” 7 above below hsides (top and bottom) vsides (left and right) 8 There is a black origin point 9 on the left side of the unordered list There is a serial number 10 starting from 50 on the left side 11 12 13 14 15 16 volvo17 f18 19 20 ddddd21 22 23 ddd24 Make a frame around the form 25 Reset 26 27 Achieve vertical display of three pages of content on one page?—– – Web page 32 realizes the horizontal display of three page contents in one page 37 The embedded 38 displays text that does not support JS 39 40 41 42 43 44 45 1 5 23 24 25…
Django calls static files such as JS, CSS, images, etc.
zz In the following example, we use media as the directory of static (CSS\JS\image files) files Method 1, 1. First customize the parameter STATIC_PATH=’./media’ . (meaning the media folder in the current file directory) in the settings.py file. 2. Importimport settingsin the urls.py file, and then add a sentence(r’^site_media/(?P.*)$’, ‘django.views.static.serve’,{‘document_root’: settings.STATIC_PATH}) Method 2. 1. Set STATIC_PATH=’./media’ in settings.py (the directory where the static files are located)2. Import settings.py in urls.pyimport settings3 .Set in URLpartterns of urls.py(‘^site_media/(?P.*)’,’django.views.static.serve’,{‘document_root’: settins.STATIC_PATH}), Methods for calling static files in files:For example: In these two methods, the main purpose is to set the directory of static files. site_media must be the same as the name in STATIC_PATH. In this way, when a request starting with site_media is parsed, the specified static file directory will be called. Django calls static files such as JS, CSS, pictures, etc.
HTML, CSS, JavaScript Cheat Sheet Recommendations_Basic Knowledge
In fact, Cheat Sheet is here to help us gather the information we use most frequently in our daily life for easy use and make our work more efficient. With them, your brain doesn’t have to spend extra time memorizing them – you just need to open the summary and find the information you want immediately. In this article, you can see the most practical HTML, CSS, Javascript cheat sheets, which can be used as reference materials and memos to help you find the ideas you want as quickly as possible. required information. See if these short lists are what you want, please leave your suggestions below the article, thank you! HTML HTML Help Manual HTML Quick Reference HTML special character cheat sheet Dreamweaver Dreamweaver Quick Reference Guide CSS CSS 3 Cheat Sheet I hope you enjoy this collection of cheat sheets and please share them with your development friends.
HTML, CSS, JavaScript Cheat Sheet Recommendations_Basic Knowledge
In fact, Cheat Sheet is here to help us gather the information we use most frequently in our daily life for easy use and make our work more efficient. With them, your brain doesn’t have to spend extra time memorizing them – you just need to open the summary and find the information you want immediately. In this article, you can see the most practical HTML, CSS, Javascript cheat sheets, which can be used as reference materials and memos to help you find the ideas you want as quickly as possible. required information. See if these short lists are what you want, please leave your suggestions below the article, thank you! HTML HTML Help Manual HTML Quick Reference HTML special character cheat sheet Dreamweaver Dreamweaver Quick Reference Guide CSS CSS 3 Cheat Sheet I hope you enjoy this collection of cheat sheets and please share them with your development friends.
In Web website building technology, what are HTML, HTML5, XHTML, CSS, SQL, JavaScript, PHP, ASP.NET, and WebServices? –
There are many technologies for building websites, such as HTML, HTML5, XHTML, CSS, SQL, Javascript, PHP, http://ASP.NET, Web Services, browser scripts, server scripts, etc. What’s the difference? Novices don’t understand anything and want to clarify the relationship and application scope of all these technologies. Reply content: A semester ago, I had almost no idea what these were like the original poster. After a semester, I almost understood them all. Let me talk about my own understanding.> <Since I haven’t been in contact for a long time, I welcome corrections if there are any mistakes~ First of all, you need to know what the process of website access is:Suppose you enter the address of this question in the browser address bar http://www.zhihu.com/question/22689579 You might as well integrate the technologies you mentioned into the development process of the Web. If you look at them from a technical and historical perspective, you will know the background of the birth of these technologies and the problems they solve. Refer to an article I once wrote: History of the Development of Web Development Technology. 1. The birth of the Web When it comes to the Web, one word that must be mentioned is “Internet”. Web…
HTML, CSS, JavaScript cheat sheet recommendations
In fact, Checklist is here to help us gather the information we use most frequently in our daily life for easy use and make our work more efficient. With them, your brain doesn’t have to spend extra time memorizing them – you just need to open the summary and find the information you want immediately. In this article, you can see the most practical HTML, CSS, Javascript cheat sheets, which can be used as reference materials and memos to help you find the ideas you want as quickly as possible. required information. See if these short lists are what you want, please leave your suggestions below the article, thank you! HTML HTML Help Manual HTML Quick Reference HTML special character cheat sheet Dreamweaver Dreamweaver Quick Reference Guide CSS CSS 3 Cheat Sheet I hope you enjoy this collection of cheat sheets and please share them with your development friends.
How to learn the basics of Web front-end? html, css, JavaScript knowledge architecture diagram
In the past, developers only needed to master the troika of HTML, CSS, and Javascript to be qualified for a front-end job. Now, in addition to ordinary coding, we also need to consider how to optimize performance and how to implement functions across terminals and platforms. Especially the advent of AI and 5G technologies are accelerating the update of front-end technology and forcing developers to constantly learning, unable to accept new technical standards. “What to learn” and “how to learn” are actually the issues we need to focus on solving. Therefore, today I will sort out the front-end knowledge framework for you, help you re-traverse the knowledge points, and make it easier to learn by checking for gaps. Let’s first look at what is knowledge architecture? We can understand it as a “catalogue” or index of knowledge. It can help us organize scattered knowledge and also help us discover some blind spots in knowledge. This article contains Javascript, CSS and HTML, as well as browser implementation principles and APIs. These three modules cover all the knowledge a front-end engineer needs to master. Javascript knowledge architecture diagram In the Javascript module, first of all, we can split the language according to…
Course assignment for learning basic HTML, CSS, and JavaScript in Web programming “Imitating 360 Speed Browser New Tab Page”…
WebBasics of Programming–HTML, CSS, Javascript Learning course assignment “Imitate 360Extremely fast browser new tab page” Background: As a technical secondary school website builder,I always made static HTML+CSS+DIV before I have learned Javascript(jQuery),This semester, I have re-learned what I have learned before and learned some scripting languages. Combined with my usual programming background, I learned it very quickly as a semester assignment, a self-defined task, and I tried to implement the new tab of 360 Speed Browser. page (I didn’t have a good idea at the beginning. I have always preferred 360 speed browser, not advertising. The school computer room is not connected to the Internet. I originally wanted to do 404. Open it alone. After opening the browser, I saw the new tab page “it felt pretty good” and decided to ‘try’ it). Knowledge points used: The most basic HTML+CSS+DIV knowledge is used Layout uses Javascript jQuery to add “special effects” to the page based on the layout. Page analysis: & #xff08;mainL) For the above picture, there are two major parts: the upper part Search, lower tab page. The search div: consists of a search bar area and a button area. Search bar area div:Search engine selection icon(There is also…
Introduction to methods and examples of javascript preloading images, css, and js_javascript skills
The advantage of preloading is that the web page can be presented to the user faster. The disadvantage is that it may increase useless requests (but static files such as pictures, css, and js can be cached). If the css, js, and pictures in the page visited by the user are cached, With preloading, users will open the page much faster, improving the user experience. When using some large pictures to display, preloading large pictures is a very good method, so that the pictures can be presented to users faster. Not much to say, as a front-end siege master, everyone knows it. Let me share the tests I did and the results obtained. First let’s talk about the status code returned by the server that you need to know:status-code: 200 – The client request is successfulstatus-code: 304 – The file is already in the browser cache, and the server tells the client that it turns out that Buffered documents can continue to be used. This article tests to determine whether the file has been cached. It is used to determine whether 304 is returned. The following is a test of several preloading methods, including loading img/js/css in different browsers, including…