Skip to content

Commit 9009a44

Browse files
committed
部分修改
1 parent f530840 commit 9009a44

File tree

8 files changed

+12
-44
lines changed

8 files changed

+12
-44
lines changed

DjangoBlog/feeds.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
from django.utils.feedgenerator import Rss201rev2Feed
2020
from DjangoBlog.utils import CommonMarkdown
2121
from django.contrib.auth import get_user_model
22-
from django.contrib.auth.models import User
23-
from DjangoBlog.utils import get_current_site
22+
from datetime import datetime
2423

2524

2625
class DjangoBlogFeed(Feed):
@@ -46,8 +45,8 @@ def item_description(self, item):
4645
return CommonMarkdown.get_markdown(item.body)
4746

4847
def feed_copyright(self):
49-
# print(get_current_site().name)
50-
return "Copyright© 2018 且听风吟"
48+
now = datetime.now()
49+
return "Copyright© {year} 且听风吟".format(year=now.year)
5150

5251
def item_link(self, item):
5352
return item.get_absolute_url()

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# DjangoBlog
22

33
🌍
4-
*[English](README-en.md)[简体中文](README.md)*
4+
*[English](/docs/README-en.md)[简体中文](README.md)*
55

66
基于`python3.6``Django2.1`的博客。
77

accounts/admin.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ def __init__(self, *args, **kwargs):
5858
class BlogUserAdmin(UserAdmin):
5959
form = BlogUserChangeForm
6060
add_form = BlogUserCreationForm
61-
list_display = ('id', 'nickname', 'username', 'email', 'last_login', 'date_joined')
61+
list_display = ('id', 'nickname', 'username', 'email', 'last_login', 'date_joined', 'source')
6262
list_display_links = ('id', 'username')
6363
ordering = ('-id',)

accounts/models.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ class BlogUser(AbstractUser):
1111
nickname = models.CharField('昵称', max_length=100, blank=True)
1212
created_time = models.DateTimeField('创建时间', default=now)
1313
last_mod_time = models.DateTimeField('修改时间', default=now)
14-
source = models.CharField("创建涞源", max_length=100, blank=True)
15-
16-
# objects = BlogUserManager()
14+
source = models.CharField("创建来源", max_length=100, blank=True)
1715

1816
def get_absolute_url(self):
1917
return reverse('blog:author_detail', kwargs={'author_name': self.username})

bin/blog.lylinux.org

+4-33
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,23 @@
1-
upstream hello_app_server {
2-
server unix:/var/www/DjangoBlog/run/gunicorn.sock fail_timeout=0;
3-
}
4-
51
server {
6-
7-
82
server_name blog.lylinux.org;
93
root /var/www/DjangoBlog/;
10-
114
listen 80;
12-
135
keepalive_timeout 70;
14-
access_log off;
156

167
location /static/ {
178
expires max;
189
alias /var/www/DjangoBlog/collectedstatic/;
1910
}
2011

2112
location / {
22-
# an HTTP header important enough to have its own Wikipedia entry:
23-
# http://en.wikipedia.org/wiki/X-Forwarded-For
13+
proxy_set_header X-Real-IP $remote_addr;
2414
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
25-
26-
# enable this if and only if you use HTTPS, this helps Rack
27-
# set the proper protocol for doing redirects:
28-
# proxy_set_header X-Forwarded-Proto https;
29-
30-
# pass the Host: header from the client right along so redirects
31-
# can be set properly within the Rack application
3215
proxy_set_header Host $http_host;
33-
34-
# we don't want nginx trying to do something clever with
35-
# redirects, we set the Host: header above already.
16+
proxy_set_header X-NginX-Proxy true;
3617
proxy_redirect off;
37-
38-
# set "proxy_buffering off" *only* for Rainbows! when doing
39-
# Comet/long-poll stuff. It's also safe to set if you're
40-
# using only serving fast clients with Unicorn + nginx.
41-
# Otherwise you _want_ nginx to buffer responses to slow
42-
# clients, really.
43-
# proxy_buffering off;
44-
45-
# Try to serve static files from nginx, no point in making an
46-
# *application* server like Unicorn/Rainbows! serve static files.
4718
if (!-f $request_filename) {
48-
proxy_pass http://hello_app_server;
49-
break;
19+
proxy_pass http://127.0.0.1:8000;
20+
break;
5021
}
5122
}
5223

bin/django_start renamed to bin/django_start.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
NAME="djangoblog" # Name of the application
4-
DJANGODIR=//var/www/DjangoBlog # Django project directory
4+
DJANGODIR=/var/www/DjangoBlog # Django project directory
55
SOCKFILE=/var/www/DjangoBlog/run/gunicorn.sock # we will communicte using this unix socket
66
USER=root # the user to run as
77
GROUP=root # the group to run as

comments/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Comment(models.Model):
1616
is_enable = models.BooleanField('是否显示', default=True, blank=False, null=False)
1717

1818
class Meta:
19-
ordering = ['-created_time']
19+
ordering = ['-id']
2020
verbose_name = "评论"
2121
verbose_name_plural = verbose_name
2222
get_latest_by = 'created_time'
File renamed without changes.

0 commit comments

Comments
 (0)