django 個人部落格系統開發 專案搭建

2021-07-11 13:48:31 字數 1437 閱讀 4296

*安裝virtualenv,建立虛擬環境

pip install virtualenv

virtualenv

pip freeze

cd c:\workspace

dirvirtualenv --system-site-packages blog_project_venv

blog_project_venv\scripts\activate

pip install django

*pycharm建立專案,設定對應的虛擬環境路徑,安裝相關庫

pycharm中

選擇interpreter為從c:\worksapace\blog_project_venv\scripts\python.exe

設定location: c:\workspace\blog_project

安裝pillow

pycharm-file-settings-project:blog_project-project interpreter + 

搜尋並安裝pillow

*靜態檔案和模板設定

靜態檔案設定

在專案主目錄下建立static資料夾

static_url = '/static/'

staticfiles_dirs = (

os.path.join(base_dir, 'static'),

)

模板設定 django1.9.5=預設設定

templates = [

, },]

把模板和靜態檔案放入相應的資料夾

配置urls

from django.conf.urls import include, url

from django.contrib import admin

from blog.views import *

urlpatterns = [

url(r'^admin/', include(admin.site.urls)),

url(r'^$', index , name='index'),

]

模板要增加靜態標籤

......

新增檢視函式

from django.shortcuts import render

# create your views here.

def index(request):

return render(request,'index.html', locals())

注意模板中編碼要改為utf-8

*執行專案 訪問網頁

django 個人部落格系統開發 富文字編輯器

常見的富文字編輯器 ckeditor ueditor kindeditor tinymce admin中新增富文字編輯器的方式 1,第三方庫,如django ckeditor 2,admin中定義富文字編輯器widget 了解 3,定義modeladmin的 檔案 1的例子 安裝django cke...

JSP Qing部落格系統開發

本篇文章主要對自己做的乙個c 識別軟體 乙個web部落格系統做專案總結.一 totool識別轉換助手 軟體打包之後在我電腦上執行正常,識別印刷體沒有問題,但在不同系統不同電腦下執行會出問題。因為核心演算法 不是自己的,有的部分bug也懶得處理了,網上有現成本地的識別工具 如abbyy finerea...

django 購物系統 開發環境搭建

安裝ubuntu虛擬機器 安裝pyenv 0 可能需要更新apt get sudo apt get update 1 安裝curl和git sudo apt get install curl git core 2 安裝pyenv 安裝依賴包 sudo apt get install y make b...