"Python Project Combat" BBS Forum (2) page initial design

Source: Internet
Author: User



One, download a page template (of course, you can write it yourself)

Find the following page, then right-save as, all saved

http://v3.bootcss.com/examples/navbar-fixed-top/#


The downloaded file is the preliminary template



Second, editor settings.py


1. Add a static page path and create a new statics folder inside the project directory

Staticfiles_dirs = ("%s/%s"% (Base_dir, "statics"),)


2, join DIRS, default generated is empty DIRS, start the service, will report abnormal

Exception type:templatedoesnotexist


templates = [    {         ' BACKEND ':   ' Django.template.backends.django.DjangoTemplates ',##  under this very key           ' DIRS ':  [os.path.join (base_dir,  ' templates ')],          ' app_dirs ': true,         ' OPTIONS ': {              ' Context_processors ': [                  ' Django.template.context_ Processors.debug ',                  ' Django.template.context_processors.request ',                  ' Django.contrib.auth.context_processors.auth ',                  ' Django.contrib.messages.context_processors.messages ',             ],        },     },]



Third, download CSS, JS template

http://www.bootcss.com/, using Bootstrap v3.3.5, a simple, intuitive, and powerful front-end development framework to make web development faster and easier.


Download jquery 2.1.4

http://www.jq22.com/jquery-info122 (jquery Download all versions (live Update))


Put the downloaded files into the Statics folder,

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/09/wKioL1cQqz6Ta5KBAACJr-zH1BE521.jpg "title=" Cssjs file. JPG "alt=" Wkiol1cqqz6ta5kbaacjr-zh1be521.jpg "/>



Iv. Editorial urls.py

urlpatterns = [url (r ' ^admin/', admin.site.urls), url (r ' ^$ ', Views.index, name= "index"),]


V. Editorial views.py

def index (request): articles = models. Article.objects.all () return render (Request, ' index.html ', {' articles ': articles})



Vi. run project, accessing 127.0.0.1:8000

Under normal circumstances the page can be accessed, but the page format is invalid, press F12 in the browser, open debug--console

Runnerw.exe C:\Python27\python.exe c:/pyfile/pyproject/s11bbs/manage.py runserver 8000Performing System checks ... System Check identified no issues (0 silenced). April, 2016-16:50:48django version 1.9.5, using Settings ' s11bbs.settings ' starting development Server at http://127.0 .0.1:8000/quit the server with Ctrl-break.


Can see is those css,js file path problem, because the downloaded template HTML file referenced css, JS and other files are the original path, now need to change their own path

Like what:

<!--Bootstrap Core CSS--<link href= "/static/bootstrap/css/bootstrap.min.css" rel= "stylesheet" >


Some files do not need to go to the original page to download

Like what:

Navbar-fixed-top.css

body {min-height:2000px; padding-top:70px;}



Error page: A single piece of troubleshooting

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7F/09/wKioL1cQrKOCYvtkAABlm9Gc2sg038.jpg "title=" Console Debug Page 1. JPG "alt=" Wkiol1cqrkocyvtkaablm9gc2sg038.jpg "/>



Seven, attached code:


# # Index.html

<! doctype html><!-- saved from url= (0049) http://v3.bootcss.com/examples/ navbar-fixed-top/# -->







This article is from the "Seeworld" blog, make sure to keep this source http://depops2016.blog.51cto.com/4205997/1764240

"Python Project Combat" BBS Forum (2) page initial design

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.