From 71416f7c1b40530c43fe632451dc4f8d6b7191f7 Mon Sep 17 00:00:00 2001 From: syk1209wwz0306 <3228195956@qq.com> Date: Fri, 31 May 2024 11:14:09 +0800 Subject: [PATCH] commit0531 --- .../__pycache__/urls.cpython-38.pyc | Bin 1061 -> 1061 bytes .../__pycache__/views.cpython-38.pyc | Bin 467 -> 467 bytes .../__pycache__/wsgi.cpython-38.pyc | Bin 596 -> 596 bytes .../Movie_recommendation_system/urls.py | 2 +- .../movie/__pycache__/admin.cpython-38.pyc | Bin 152 -> 0 bytes .../movie/__pycache__/apps.cpython-38.pyc | Bin 416 -> 151 bytes .../context_processors.cpython-38.pyc | Bin 452 -> 452 bytes .../movie/__pycache__/forms.cpython-38.pyc | Bin 2505 -> 0 bytes .../movie/__pycache__/models.cpython-38.pyc | Bin 5026 -> 5026 bytes .../movie/__pycache__/tests.cpython-38.pyc | Bin 196 -> 0 bytes .../movie/__pycache__/urls.cpython-38.pyc | Bin 430 -> 430 bytes .../movie/__pycache__/views.cpython-38.pyc | Bin 3023 -> 3023 bytes MoviesRecommend/movie/admin.py | 0 MoviesRecommend/movie/apps.py | 6 -- MoviesRecommend/movie/forms.py | 68 ------------------ MoviesRecommend/movie/tests.py | 3 - MoviesRecommend/movie/urls.py | 3 - MoviesRecommend/movie/views.py | 2 +- MoviesRecommend/templates/index.html | 8 +-- MoviesRecommend/templates/movie/base.html | 2 - MoviesRecommend/templates/movie/index.html | 9 ++- MoviesRecommend/templates/movie/search.html | 2 +- 22 files changed, 11 insertions(+), 94 deletions(-) delete mode 100644 MoviesRecommend/movie/__pycache__/admin.cpython-38.pyc delete mode 100644 MoviesRecommend/movie/__pycache__/forms.cpython-38.pyc delete mode 100644 MoviesRecommend/movie/__pycache__/tests.cpython-38.pyc delete mode 100644 MoviesRecommend/movie/admin.py delete mode 100644 MoviesRecommend/movie/forms.py delete mode 100644 MoviesRecommend/movie/tests.py diff --git a/MoviesRecommend/Movie_recommendation_system/__pycache__/urls.cpython-38.pyc b/MoviesRecommend/Movie_recommendation_system/__pycache__/urls.cpython-38.pyc index 753ec86c432a841128c4ab1e3a562cf971408a34..8f2b4ae687be1522a3a72ba91680210abf988324 100644 GIT binary patch delta 22 ccmZ3=v6O>1l$V!_0SM-)M5c9b1l$V!_0SMG}1JaId) delta 20 acmcb@a)pIEl$V!_0SKD5`EBI(WC8#*Zv?^s diff --git a/MoviesRecommend/Movie_recommendation_system/urls.py b/MoviesRecommend/Movie_recommendation_system/urls.py index 1a442c6..cc62c7e 100644 --- a/MoviesRecommend/Movie_recommendation_system/urls.py +++ b/MoviesRecommend/Movie_recommendation_system/urls.py @@ -20,7 +20,7 @@ from django.urls import path, include from .views import index, star urlpatterns = [ - #path('admin/', admin.site.urls), # 后台管理系统 + path('', index), # 首页 path('movie/', include('movie.urls')), # 电影推荐系统子路由 ] diff --git a/MoviesRecommend/movie/__pycache__/admin.cpython-38.pyc b/MoviesRecommend/movie/__pycache__/admin.cpython-38.pyc deleted file mode 100644 index 040ac671210543165e8ab084a9b5f4dafa32c9ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 152 zcmWIL<>g`kf>*!&(m?cM5P=LBfgA@QE@lA|DGb33nv8xc8Hzx{2;!HmvsFxJacWU< zjD?w@nORIgWpYMhQEos{epYI7NpXyCepzN}aZqYQS5SG2 T!zMRBr8Fni4rJ_SAZ7pn$pa-B diff --git a/MoviesRecommend/movie/__pycache__/apps.cpython-38.pyc b/MoviesRecommend/movie/__pycache__/apps.cpython-38.pyc index 66558c8a115df82c2ccd666e733515585036ad4d..4afc185e9fd6b4ea1a84b941177ad5def687b6b6 100644 GIT binary patch delta 96 zcmZ3$Je|=wl$V!_0SF?MBGW+hV-SH17=auIATDMB5-AM944RC7D;bJF!cbx|E2E?E UEe@O9{FKt1R6CH&XCP((0869|!2kdN literal 416 zcmYjNy-EW?5Z=ALK+I1gK7j2t0h>c4NF;@oAt-5%gXMC&#)RzcxoZL`th7}u>}|Ca zu?jwcZ?Kgh8hr&TXD)&nm~ZBr{dQ({d-ZySfW5x;U&>Rv5%#RO^q delta 20 acmX@Ye1w@hl$V!_0SJOt1a9Qs$p`>3H3ZZE diff --git a/MoviesRecommend/movie/__pycache__/forms.cpython-38.pyc b/MoviesRecommend/movie/__pycache__/forms.cpython-38.pyc deleted file mode 100644 index 19dc131b2ee2ac4dea0a8dfca20cde9068165d6d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2505 zcmcIm&u<$=6rR~%Ub~w#iAoEF7K9Mg0gU*es8mpb0!2u~s#-NdE2GuonYea#ZD(fP z63doa5*jW!@ed>t94sOA!Xc`F3;)GjNoacF&WZPC?bs&nk(K6o_RY?lH{bW>8{e9m z$`N=z`eSAFOP7#8@n!U};AIh-Tmi!fqY;UzPbv0|$cRnfj4j`yaayxC zP2T~J%^dJJeNP5F8Rmk=?R#97y-D)9ClH(Dsj^oaB9?hWS+^t?%3E&Ssq#RCNwr=n z<2R#^*?*B&p~Hz!8SxEn)+|Puu|s`3&Bu4P$tu;Exc*26n}+Xh6N~tmK~{M;c%>>6 zF0MfePY5NXM^!EkzX>8;P$-8J^eC*-Sl zx@O0O-%DMqW9^#ScfMqF?XJ_Y8C^5Pe8tas6z^xJi0OQDtH-Wmw@o zTRB{ahLCEi!jqsT8})#NNvNDVVbtPM+0}%{QaNF>$?L3_QI_Pgi9HyDBi&5na7(#Q@q8@eWjBf37qi`37Gsa-X+C!GH$tz$I zlF$y>G!Wh{1(;1n_oxQkWCrxij?ppKOtFwyHO>DH{T99hhV7zqo1v6<8-l6RgI*wb zlZQ#`A_PC!|M9P%_YNOEc)WZ6==UEEzx(N6f9GKT-qH3ifB$;FM>R%yN7=H~gzecd zMcL(uhjnGb284l*(<@pa8+f)Adi%@TICUw z>5gzC!@VgBmqEZK^6Nrfh&P~<&xzOY!%JxLXf&YNC8)h?7)=8vp2ZP_M^92yee}va ziUtVk^v^uG@9Dr{u?>M6N(#t}gR%nhf>P3#H&srw3nA<5dv*TH6a*$4Bf3ixP8SZu{5yi=sBHqOCuYghB z=k_2+kdjxtWo`;dVBVK?X@h%#DsPJ6sgC}0ZaZ{_8 zcnQ7lq0z@`h#Ag#ADYyEBD7AqblPaoj%>3qS)}lEFXB`zfdPixOhu|<;PnmLvD!1E zp>)k-A}W*KK1mVw@E_ekSrN#Lcpc3ouCWq6hL)ZSV<15%LLCc@D2#{FIOwuL>@FXN zq985kDZ*b0ht>UJ$*|Sv^+|!l>+lr*<}<=EC($~y53SgCgiQ$4^r{Hisb4- N^^6&7?!w%ee*vL`9c2Ij diff --git a/MoviesRecommend/movie/__pycache__/models.cpython-38.pyc b/MoviesRecommend/movie/__pycache__/models.cpython-38.pyc index 7ad0b130e429a24981142674aa3a0e69dc128331..1e0ffe0090a9ba5085d662e90e1e0143d5fcf32f 100644 GIT binary patch delta 20 acmZ3azDS)rl$V!_0SFE&L~i7sE(`!M76iEf delta 20 acmZ3azDS)rl$V!_0SLklhHd1YE(`!M(gf-N diff --git a/MoviesRecommend/movie/__pycache__/tests.cpython-38.pyc b/MoviesRecommend/movie/__pycache__/tests.cpython-38.pyc deleted file mode 100644 index 64d0d5eaaecb1d0b46cdbeb22f55045eb1b7b04d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 196 zcmWIL<>g`kf(6g-#n}Mq#~=k{ diff --git a/MoviesRecommend/movie/__pycache__/views.cpython-38.pyc b/MoviesRecommend/movie/__pycache__/views.cpython-38.pyc index 322c5688e2b7ec43d868048c7f3121f3d01f0826..bbad21ca0bcfbb62d025dd207fa61ca84f1973f5 100644 GIT binary patch delta 30 kcmX>veqNk6l$V!_0SI`MBh%P6@*ZVmn#HvF3gd510BpDi^#A|> delta 30 kcmX>veqNk6l$V!_0SNrGBGTA5@*ZVmdcnN;3gd510CTVijQ{`u diff --git a/MoviesRecommend/movie/admin.py b/MoviesRecommend/movie/admin.py deleted file mode 100644 index e69de29..0000000 diff --git a/MoviesRecommend/movie/apps.py b/MoviesRecommend/movie/apps.py index 5897a90..e69de29 100644 --- a/MoviesRecommend/movie/apps.py +++ b/MoviesRecommend/movie/apps.py @@ -1,6 +0,0 @@ -from django.apps import AppConfig - - -class MovieConfig(AppConfig): - name = 'movie' - verbose_name = "电影推荐系统" diff --git a/MoviesRecommend/movie/forms.py b/MoviesRecommend/movie/forms.py deleted file mode 100644 index 62cf5bb..0000000 --- a/MoviesRecommend/movie/forms.py +++ /dev/null @@ -1,68 +0,0 @@ -from django import forms - -from movie.models import User, Movie_rating - - -# 注册用的表单 -class RegisterForm(forms.ModelForm): - password_repeat = forms.CharField(max_length=256) - - def get_errors(self): - errors = self.errors.get_json_data() - errors_lst = [] - for messages in errors.values(): - for message_dict in messages: - for key, message in message_dict.items(): - if key == 'message': - errors_lst.append(message) - return errors_lst - - # 普通验证之后的最后一层验证 - # 验证密码 - def clean(self): - cleaned_data = super(RegisterForm, self).clean() - pwd = cleaned_data.get('password') - password_repeat = cleaned_data.get('password_repeat') - if pwd != password_repeat: - raise forms.ValidationError(message='两次密码输入不一致!') - return cleaned_data - - class Meta: - model = User - fields = ['name', 'password', 'email'] - - -# 登录的表单 -class LoginForm(forms.ModelForm): - name = forms.CharField(max_length=128) - remember = forms.IntegerField(required=False) - - class Meta: - model = User - fields = ['password'] - - def get_errors(self): - errors = self.errors.get_json_data() - errors_lst = [] - for messages in errors.values(): - for message_dict in messages: - for key, message in message_dict.items(): - if key == 'message': - errors_lst.append(message) - return errors_lst - - -# 表单验证通过后再验证分数是否为0 -class CommentForm(forms.ModelForm): - def clean(self): - cleaned_data = super(CommentForm, self).clean() - score = cleaned_data.get('score') - if score == 0: - raise forms.ValidationError(message='评分不能为空!') - else: - return cleaned_data - - class Meta: - # 电影评分,只记录评分和评论 - model = Movie_rating - fields = ['score', 'comment'] \ No newline at end of file diff --git a/MoviesRecommend/movie/tests.py b/MoviesRecommend/movie/tests.py deleted file mode 100644 index 7ce503c..0000000 --- a/MoviesRecommend/movie/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/MoviesRecommend/movie/urls.py b/MoviesRecommend/movie/urls.py index 3b82959..f718b17 100644 --- a/MoviesRecommend/movie/urls.py +++ b/MoviesRecommend/movie/urls.py @@ -8,13 +8,10 @@ app_name = 'movie' urlpatterns = [ # 默认首页 path('', views.IndexView.as_view(), name='index'), - # 电影详情页面 path('detail/', views.MovieDetailView.as_view(), name='detail'), # 搜索功能 path('search', views.SearchView.as_view(), name='search'), - - ] diff --git a/MoviesRecommend/movie/views.py b/MoviesRecommend/movie/views.py index 515e6cf..1a92159 100644 --- a/MoviesRecommend/movie/views.py +++ b/MoviesRecommend/movie/views.py @@ -14,7 +14,7 @@ class IndexView(ListView): # 返回前1000部电影 def get_queryset(self): - return Movie.objects.order_by(self.ordering).filter(imdb_id__lte=1000) + return Movie.objects.order_by(self.ordering).filter(imdb_id__lte=666) # 获取上下文数据 def get_context_data(self, *, object_list=None, **kwargs): diff --git a/MoviesRecommend/templates/index.html b/MoviesRecommend/templates/index.html index 9c1dee5..6a4ea25 100644 --- a/MoviesRecommend/templates/index.html +++ b/MoviesRecommend/templates/index.html @@ -36,13 +36,13 @@ html, body { height: 100%; - background-color: #333; + background-color: #658ab5; } body { color: #fff; text-align: center; - text-shadow: 0 1px 3px rgba(0, 0, 0, 0.48); + text-shadow: 0 1px 3px rgb(3, 31, 67); } /* Extra markup and styles for table-esque vertical and horizontal centering */ @@ -51,8 +51,8 @@ width: 100%; height: 100%; /* For at least Firefox */ min-height: 100%; - -webkit-box-shadow: inset 0 0 100px rgba(0, 0, 0, .5); - box-shadow: inset 0 0 100px rgba(0, 0, 0, .5); + -webkit-box-shadow: inset 0 0 100px rgb(3, 31, 67); + box-shadow: inset 0 0 100px rgb(3, 31, 67); } .site-wrapper-inner { diff --git a/MoviesRecommend/templates/movie/base.html b/MoviesRecommend/templates/movie/base.html index 6b59940..740e22f 100644 --- a/MoviesRecommend/templates/movie/base.html +++ b/MoviesRecommend/templates/movie/base.html @@ -20,8 +20,6 @@ data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> Toggle navigation - - Django电影推荐系统 diff --git a/MoviesRecommend/templates/movie/index.html b/MoviesRecommend/templates/movie/index.html index 49e8deb..3219b89 100644 --- a/MoviesRecommend/templates/movie/index.html +++ b/MoviesRecommend/templates/movie/index.html @@ -18,12 +18,11 @@

项目简介

-

数据集:本系统使用最新的movielens数据集版本ml-latest-small该数据集,该数据集包含9742部电影、 - 610个用户、100837个评分。有 links.csv (电影的imdbid和tmdbid)、 movies.csv (电影详情)、 ratings.csv (电影评分数据集 )等数据。 +

-

系统首页会展示部分电影,热门电影会展示评分最高的前100部电影,你可以点击任意一部电影查看详情

-

你可以给电影评分(需登录),查看网站对你的推荐(基于用户的协同过滤算法)

-

使用分类或搜索功能可以帮助你找到电影

+

系统首页会展示部分电影,你可以点击任意一部电影查看详情

+ +

使用搜索功能可以帮助你找到电影

diff --git a/MoviesRecommend/templates/movie/search.html b/MoviesRecommend/templates/movie/search.html index fcfb648..7011a65 100644 --- a/MoviesRecommend/templates/movie/search.html +++ b/MoviesRecommend/templates/movie/search.html @@ -31,7 +31,7 @@

{{ movie.name }} - {{ movie.get_score }} +