Because the version of django is quite different, the following configuration is for learning reference only.
D:/www/mysite>python --version
Python 2.7.5
>>> print django.__version__
1.9.4
This record will not be explained in detail, the main configuration process is as follows:
1.settings.py last paragraph, about static file configuration
# Static files (CSS, JavaScript, Images)# https://docs.djangoproject.com/en/1.9/howto/static-files/SITE_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')STATIC_ROOT = os.path.join(SITE_ROOT, 'static')STATIC_URL = '/static/'STATICFILES_DIRS = (("css", os.path.join(STATIC_ROOT, 'css')),("js", os.path.join(STATIC_ROOT, 'js')),("images", os.path.join(STATIC_ROOT, 'images')),("bower_components", os.path.join(STATIC_ROOT, 'bower_components')),)2.urls.py About routing configuration
urlpatterns = [url(r'^admin/', admin.site.urls),url(r'^$', views.index),url(r'^home/', views.home),]
3.views.py view design, the kind that cannot be simpler.
def home(request):return render_to_response('home/login.html')4. Template calls home/login.html page for static files such as css, js, and pictures.
<!-- Bootstrap Core CSS --><link href="/static/bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"><!-- Custom CSS --><link href="/static/css/sb-admin-2.css" rel="stylesheet"><img src="/static/images/xjlxprocess.png" />
5. Finally, my directory structure is as described in other articles on the Internet.
website--------static ----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
6. The site is opened as follows:
The above content is a detailed explanation of the BootStrap thrown into Django introduced by the editor. I hope it will be helpful to everyone. If you want to know more information, please pay attention to the Wulin.com website!