Karena versi Django sangat berbeda, konfigurasi berikut hanya untuk belajar referensi.
D:/www/mysite> python --version
Python 2.7.5
>>> Cetak Django .__ Versi__
1.9.4
Catatan ini tidak akan dijelaskan secara rinci, proses konfigurasi utama adalah sebagai berikut:
1.settings.py paragraf terakhir, tentang konfigurasi file statis
# File statis (CSS, JavaScript, gambar)# https://docs.djangoproject.com/en/1.9/howto/static-files/site_root = os.path.join (os.path.abspath (os.path.dirname (__ file__), '..') 'Static') static_url = '/static/' staticfiles_dirs = (("css", os.path.join (static_root, 'css')), ("js", os.path.join (static_root, 'js')), ("gambar", os.path.join (static_root, 'js')), ("gambar", os.path.join (static_root, 'js')), ("", os.path.join (static_root, 'js')), ("", os.path.join (static_root, 'js')), ("", os.join (static_root, 'js')), ("oS.join (static_root, 'js'))))) 'gambar')), ("bower_components", os.path.join (static_root, 'bower_components')),)2.urls.py tentang konfigurasi perutean
urlpatterns = [url (r '^admin/', admin.site.urls), url (r '^$', views.index), url (r '^home/', views.home),]
3.Views.py View Design, jenis yang tidak bisa lebih sederhana.
def home (request): return render_to_response ('home/login.html')4. Template Panggilan Home/Login.html Halaman untuk file statis seperti CSS, JS, dan gambar.
<!-Bootstrap CSS CSS-> <link href = "/static/bower_components/bootstrap/dist/css/bootstrap.min.css" rel = "stylesheet"> <!-csss custo-> <link href = "/static/css/sb-admin-> <link href ="/static/css/sb-admin-2 src = "/statis/gambar/xjlxprocess.png"/>
5. Akhirnya, struktur direktori saya seperti yang dijelaskan dalam artikel lain di Internet.
Situs web -------- statis ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
6. Situs dibuka sebagai berikut:
Konten di atas adalah penjelasan terperinci tentang bootstrap yang dilemparkan ke Django yang diperkenalkan oleh editor. Saya harap ini akan membantu semua orang. Jika Anda ingin mengetahui informasi lebih lanjut, harap perhatikan situs web Wulin.com!