STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static_cdn")
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
]
MEDIA_URL = "/media/"
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "media_cdn")
Django-blog/
├── media_cdn
│ ├── 11
│ ├── 13
│ ├── 16
│ └── None
├── mysite
│ ├── blog
│ │ ├── migrations
│ │ └── templates
│ ├── comments
│ │ └── migrations
│ ├── mysite
│ └── static
│ └── css
├── static_cdn
│ ├── admin
│ │ ├── css
│ │ ├── fonts
│ │ ├── img
│ │ │ └── gis
│ │ └── js
│ │ ├── admin
│ │ └── vendor
│ │ ├── jquery
│ │ └── xregexp
│ ├── css
│ ├── pagedown
│ │ ├── demo
│ │ │ ├── browser
│ │ │ └── node
│ │ └── local
│ └── pagedown-extra
│ └── pagedown
/etc/nginx/sites-available
server {
listen 80;
server_name мой_ip; #либо ip, либо доменное имя
access_log /var/log/nginx/example.log;
location /static/ {
root home/splitpoint/Django-blog/mysite/static/;
expires 30d;
}
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
int@debian:/home/Django-blog/mysite$ python manage.py collectstatic
You have requested to collect static files at the destination
location as specified in your settings:
/home/Django-blog/static_cdn
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: y
CommandError: Collecting static files cancelled.
int@debian:/home/Django-blog/mysite$ python manage.py collectstatic --noinput
0 static files copied to '/home/Django-blog/static_cdn', 77 unmodified.
int@debian:/home/Django-blog/mysite$ python manage.py collectstatic
You have requested to collect static files at the destination
location as specified in your settings:
/home/Django-blog/static_cdn
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: y
CommandError: Collecting static files cancelled.
int@debian:/home/Django-blog/mysite$ python manage.py collectstatic
You have requested to collect static files at the destination
location as specified in your settings:
/home/Django-blog/static_cdn
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: y
CommandError: Collecting static files cancelled.
server {
listen 80;
server_name мой_ip; #либо ip, либо доменное имя
access_log /var/log/nginx/example.log;
location /static/ {
root /home/Django-blog/static_cdn;
expires 30d;
}
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
int@debian:/home/Django-blog/mysite$ python manage.py collectstatic
You have requested to collect static files at the destination
location as specified in your settings:
/home/Django-blog/static_cdn
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
0 static files copied to '/home/Django-blog/static_cdn', 77 unmodified.
int@debian:/home/Django-blog$ cd mysite/
int@debian:/home/Django-blog/mysite$ ls
blog comments db.sqlite3 manage.py mysite static
int@debian:/home/Django-blog/mysite$ gunicorn mysite.wsgi:application
[2017-05-03 14:36:03 +0000] [62096] [INFO] Starting gunicorn 19.7.1
[2017-05-03 14:36:03 +0000] [62096] [INFO] Listening at: http://127.0.0.1:8000 (62096)
[2017-05-03 14:36:03 +0000] [62096] [INFO] Using worker: sync
[2017-05-03 14:36:03 +0000] [62101] [INFO] Booting worker with pid: 62101
int@debian:/home/Django-blog/static_cdn$ tree
.
├── admin
│ ├── css
│ │ ├── base.css
│ │ ├── changelists.css
│ │ ├── dashboard.css
│ │ ├── fonts.css
│ │ ├── forms.css
│ │ ├── login.css
│ │ ├── pagedown.css
│ │ ├── rtl.css
│ │ └── widgets.css
│ ├── fonts
│ │ ├── LICENSE.txt
│ │ ├── README.txt
│ │ ├── Roboto-Bold-webfont.woff
│ │ ├── Roboto-Light-webfont.woff
│ │ └── Roboto-Regular-webfont.woff
│ ├── img
│ │ ├── calendar-icons.svg
│ │ ├── gis
│ │ │ ├── move_vertex_off.svg
│ │ │ └── move_vertex_on.svg
│ │ ├── icon-addlink.svg
│ │ ├── icon-alert.svg
│ │ ├── icon-calendar.svg
│ │ ├── icon-changelink.svg
│ │ ├── icon-clock.svg
│ │ ├── icon-deletelink.svg
│ │ ├── icon-no.svg
│ │ ├── icon-unknown-alt.svg
│ │ ├── icon-unknown.svg
│ │ ├── icon-yes.svg
│ │ ├── inline-delete.svg
│ │ ├── LICENSE
│ │ ├── README.txt
│ │ ├── search.svg
│ │ ├── selector-icons.svg
│ │ ├── sorting-icons.svg
│ │ ├── tooltag-add.svg
│ │ └── tooltag-arrowright.svg
│ └── js
│ ├── actions.js
│ ├── actions.min.js
│ ├── admin
│ │ ├── DateTimeShortcuts.js
│ │ └── RelatedObjectLookups.js
│ ├── calendar.js
│ ├── cancel.js
│ ├── change_form.js
│ ├── collapse.js
│ ├── collapse.min.js
│ ├── core.js
│ ├── inlines.js
│ ├── inlines.min.js
│ ├── jquery.init.js
│ ├── pagedown.js
│ ├── popup_response.js
│ ├── prepopulate_init.js
│ ├── prepopulate.js
│ ├── prepopulate.min.js
│ ├── SelectBox.js
│ ├── SelectFilter2.js
│ ├── timeparse.js
│ ├── urlify.js
│ └── vendor
│ ├── jquery
│ │ ├── jquery.js
│ │ ├── jquery.min.js
│ │ └── LICENSE-JQUERY.txt
│ └── xregexp
│ ├── LICENSE-XREGEXP.txt
│ ├── xregexp.js
│ └── xregexp.min.js
├── css
│ └── base.css
├── pagedown
│ ├── demo
│ │ ├── browser
│ │ │ ├── demo.css
│ │ │ └── demo.html
│ │ └── node
│ │ └── demo.js
│ ├── LICENSE.txt
│ ├── local
│ │ └── Markdown.local.fr.js
│ ├── Markdown.Converter.js
│ ├── Markdown.Editor.js
│ ├── Markdown.Sanitizer.js
│ ├── node-pagedown.js
│ └── wmd-buttons.png
├── pagedown-extra
│ ├── Markdown.Extra.js
│ └── pagedown
│ └── Markdown.Converter.js
└── pagedown_init.js
18 directories, 77 files
109.167.253.79 - - [03/May/2017:15:05:30 +0300] "GET /admin/login/?next=/admin/ HTTP/1.1" 200 870 "-" "Mozilla/5.0 (X11; Ubuntu; Linux$
109.167.253.79 - - [03/May/2017:15:05:30 +0300] "GET /static/admin/css/base.css HTTP/1.1" 404 142 "http://194.87.102.184/admin/login/?$
109.167.253.79 - - [03/May/2017:15:05:30 +0300] "GET /static/admin/css/login.css HTTP/1.1" 404 142 "http://194.87.102.184/admin/login/$
109.167.253.79 - - [03/May/2017:15:05:34 +0300] "GET /post/ HTTP/1.1" 200 1921 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) G$
109.167.253.79 - - [03/May/2017:15:05:34 +0300] "GET /media/None/tarantino-20years-filmmaking.jpg HTTP/1.1" 404 260 "http://194.87.102$
109.167.253.79 - - [03/May/2017:15:05:34 +0300] "GET /media/None/385439.jpg HTTP/1.1" 404 260 "http://194.87.102.184/post/" "Mozilla/5$
109.167.253.79 - - [03/May/2017:15:05:35 +0300] "GET /static/css/base.css HTTP/1.1" 404 142 "http://194.87.102.184/post/" "Mozilla/5.0$
109.167.253.79 - - [03/May/2017:15:05:35 +0300] "GET /media/None/tarantino-20years-filmmaking.jpg HTTP/1.1" 404 260 "http://194.87.102$
109.167.253.79 - - [03/May/2017:15:05:35 +0300] "GET /media/None/385439.jpg HTTP/1.1" 404 260 "http://194.87.102.184/post/" "Mozilla/5$
187.87.87.27 - - [03/May/2017:15:05:44 +0300] "GET / HTTP/1.1" 404 340 "-" "curl/7.17.1 (mips-unknown-linux-gnu) libcurl/7.17.1 OpenSS$
187.87.87.80 - - [03/May/2017:15:19:06 +0300] "GET / HTTP/1.1" 499 0 "-" "curl/7.17.1 (mips-unknown-linux-gnu) libcurl/7.17.1 OpenSSL/$
location /static/ {
alias /home/Django-blog/static_cdn;
expires 30d;
}