diff --git a/MoviesRecommend/Movie_recommendation_system/__pycache__/urls.cpython-38.pyc b/MoviesRecommend/Movie_recommendation_system/__pycache__/urls.cpython-38.pyc index 753ec86..8f2b4ae 100644 Binary files a/MoviesRecommend/Movie_recommendation_system/__pycache__/urls.cpython-38.pyc and b/MoviesRecommend/Movie_recommendation_system/__pycache__/urls.cpython-38.pyc differ diff --git a/MoviesRecommend/Movie_recommendation_system/__pycache__/views.cpython-38.pyc b/MoviesRecommend/Movie_recommendation_system/__pycache__/views.cpython-38.pyc index b8cc812..5424954 100644 Binary files a/MoviesRecommend/Movie_recommendation_system/__pycache__/views.cpython-38.pyc and b/MoviesRecommend/Movie_recommendation_system/__pycache__/views.cpython-38.pyc differ diff --git a/MoviesRecommend/Movie_recommendation_system/__pycache__/wsgi.cpython-38.pyc b/MoviesRecommend/Movie_recommendation_system/__pycache__/wsgi.cpython-38.pyc index bdaf2e0..a3bc575 100644 Binary files a/MoviesRecommend/Movie_recommendation_system/__pycache__/wsgi.cpython-38.pyc and b/MoviesRecommend/Movie_recommendation_system/__pycache__/wsgi.cpython-38.pyc differ 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 040ac67..0000000 Binary files a/MoviesRecommend/movie/__pycache__/admin.cpython-38.pyc and /dev/null differ diff --git a/MoviesRecommend/movie/__pycache__/apps.cpython-38.pyc b/MoviesRecommend/movie/__pycache__/apps.cpython-38.pyc index 66558c8..4afc185 100644 Binary files a/MoviesRecommend/movie/__pycache__/apps.cpython-38.pyc and b/MoviesRecommend/movie/__pycache__/apps.cpython-38.pyc differ diff --git a/MoviesRecommend/movie/__pycache__/context_processors.cpython-38.pyc b/MoviesRecommend/movie/__pycache__/context_processors.cpython-38.pyc index 70a7734..4e33702 100644 Binary files a/MoviesRecommend/movie/__pycache__/context_processors.cpython-38.pyc and b/MoviesRecommend/movie/__pycache__/context_processors.cpython-38.pyc differ diff --git a/MoviesRecommend/movie/__pycache__/forms.cpython-38.pyc b/MoviesRecommend/movie/__pycache__/forms.cpython-38.pyc deleted file mode 100644 index 19dc131..0000000 Binary files a/MoviesRecommend/movie/__pycache__/forms.cpython-38.pyc and /dev/null differ diff --git a/MoviesRecommend/movie/__pycache__/models.cpython-38.pyc b/MoviesRecommend/movie/__pycache__/models.cpython-38.pyc index 7ad0b13..1e0ffe0 100644 Binary files a/MoviesRecommend/movie/__pycache__/models.cpython-38.pyc and b/MoviesRecommend/movie/__pycache__/models.cpython-38.pyc differ diff --git a/MoviesRecommend/movie/__pycache__/tests.cpython-38.pyc b/MoviesRecommend/movie/__pycache__/tests.cpython-38.pyc deleted file mode 100644 index 64d0d5e..0000000 Binary files a/MoviesRecommend/movie/__pycache__/tests.cpython-38.pyc and /dev/null differ diff --git a/MoviesRecommend/movie/__pycache__/urls.cpython-38.pyc b/MoviesRecommend/movie/__pycache__/urls.cpython-38.pyc index de18e51..c6df535 100644 Binary files a/MoviesRecommend/movie/__pycache__/urls.cpython-38.pyc and b/MoviesRecommend/movie/__pycache__/urls.cpython-38.pyc differ diff --git a/MoviesRecommend/movie/__pycache__/views.cpython-38.pyc b/MoviesRecommend/movie/__pycache__/views.cpython-38.pyc index 322c568..bbad21c 100644 Binary files a/MoviesRecommend/movie/__pycache__/views.cpython-38.pyc and b/MoviesRecommend/movie/__pycache__/views.cpython-38.pyc differ 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 }} +