# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php7.0-fpm:
# fastcgi_pass unix:/run/php/php7.0-fpm.sock;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
(mag_env) anton@anton-X451CA:~/Django-u/magazine$ python manage.py collectstatic
You have requested to collect static files at the destination
location as specified in your settings:
/home/anton/Django-u/magazine/static
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/anton/Django-u/magazine/static', 1195 unmodified.
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=sammy
Group=www-data
WorkingDirectory=/home/anton/Django-u/magazine
ExecStart=/home/anton/virtenvs/mag_env/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/anton/Django-u/magazine/magazine.sock magazine_project.wsgi:application
[Install]
WantedBy=multi-user.target
(mag_env) anton@anton-X451CA:~/Django-u/magazine$ sudo systemctl start gunicorn
Failed to start gunicorn.service: Unit gunicorn.service is not loaded properly: Invalid argument.
See system logs and 'systemctl status gunicorn.service' for details.
(mag_env) anton@anton-X451CA:~/Django-u/magazine$ systemctl status gunicorn.service
● gunicorn.service - gunicorn daemon
Loaded: error (Reason: Invalid argument)
Active: inactive (dead)
(mag_env) anton@anton-X451CA:~/Django-u/magazine$ sudo systemctl enable gunicornSynchronizing state of gunicorn.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install enable gunicorn
(mag_env) anton@anton-X451CA:~/Django-u/magazine$ sudo systemctl status gunicorn● gunicorn.service - gunicorn daemon
Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset:
Active: active (running) since Вс 2017-08-13 18:25:31 +07; 37s ago
Main PID: 4396 (gunicorn)
CGroup: /system.slice/gunicorn.service
├─4396 /home/anton/virtenvs/mag_env/bin/python3 /home/anton/virtenvs/
├─4401 /home/anton/virtenvs/mag_env/bin/python3 /home/anton/virtenvs/
├─4402 /home/anton/virtenvs/mag_env/bin/python3 /home/anton/virtenvs/
└─4404 /home/anton/virtenvs/mag_env/bin/python3 /home/anton/virtenvs/
авг 13 18:25:31 anton-X451CA systemd[1]: Started gunicorn daemon.
авг 13 18:25:31 anton-X451CA gunicorn[4396]: [2017-08-13 18:25:31 +0700] [4396]
авг 13 18:25:31 anton-X451CA gunicorn[4396]: [2017-08-13 18:25:31 +0700] [4396]
авг 13 18:25:31 anton-X451CA gunicorn[4396]: [2017-08-13 18:25:31 +0700] [4396]
авг 13 18:25:31 anton-X451CA gunicorn[4396]: [2017-08-13 18:25:31 +0700] [4401]
авг 13 18:25:31 anton-X451CA gunicorn[4396]: [2017-08-13 18:25:31 +0700] [4402]
авг 13 18:25:31 anton-X451CA gunicorn[4396]: [2017-08-13 18:25:31 +0700] [4404]
авг 13 18:25:32 anton-X451CA systemd[1]: Started gunicorn daemon.
server {
listen 80;
server_name 192.168.10.4;
access_log /var/log/nginx/example.log;
location /static/ {
root /home/anton/Django-u/magazine;
}
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;
}
}
root@anton-X451CA:/home/anton# sudo /etc/init.d/celeryd start
celery init v10.1.
Using config script: /etc/default/celeryd
celery multi v4.0.2 (latentcall)
> Starting nodes...
> irr_parser@anton-X451CA: OK
Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/anton/Django-u/irr_parser/env-34/lib/python3.5/site-packages/celery/__main__.py", line 18, in <module>
main()
File "/home/anton/Django-u/irr_parser/env-34/lib/python3.5/site-packages/celery/__main__.py", line 14, in main
_main()
File "/home/anton/Django-u/irr_parser/env-34/lib/python3.5/site-packages/celery/bin/celery.py", line 326, in main
cmd.execute_from_commandline(argv)
File "/home/anton/Django-u/irr_parser/env-34/lib/python3.5/site-packages/celery/bin/celery.py", line 488, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
File "/home/anton/Django-u/irr_parser/env-34/lib/python3.5/site-packages/celery/bin/base.py", line 281, in execute_from_commandline
return self.handle_argv(self.prog_name, argv[1:])
File "/home/anton/Django-u/irr_parser/env-34/lib/python3.5/site-packages/celery/bin/celery.py", line 480, in handle_argv
return self.execute(command, argv)
File "/home/anton/Django-u/irr_parser/env-34/lib/python3.5/site-packages/celery/bin/celery.py", line 412, in execute
).run_from_argv(self.prog_name, argv[1:], command=argv[0])
File "/home/anton/Django-u/irr_parser/env-34/lib/python3.5/site-packages/celery/bin/worker.py", line 220, in run_from_argv
self.maybe_detach([command] + argv)
File "/home/anton/Django-u/irr_parser/env-34/lib/python3.5/site-packages/celery/bin/worker.py", line 227, in maybe_detach
detached_celeryd(self.app).execute_from_commandline(argv)
File "/home/anton/Django-u/irr_parser/env-34/lib/python3.5/site-packages/celery/bin/celeryd_detach.py", line 96, in execute_from_commandline
**vars(options)
File "/home/anton/Django-u/irr_parser/env-34/lib/python3.5/site-packages/celery/bin/celeryd_detach.py", line 32, in detach
after_forkers=False):
File "/home/anton/Django-u/irr_parser/env-34/lib/python3.5/site-packages/celery/platforms.py", line 334, in open
self.after_chdir()
File "/home/anton/Django-u/irr_parser/env-34/lib/python3.5/site-packages/celery/platforms.py", line 411, in after_chdir_do
logfile and open(logfile, 'a').close()
<b>PermissionError: [Errno 13] Permission denied: '/var/log/celery/irr_parser.log'</b>
pip install django-nested-admin
В settings.py, в INSTALLED_APPS:
'nested_admin',
В urls.py:
url(r'^nested_admin/', include('nested_admin.urls'))
Что еще нужно сделать? Пользуюсь Python 3 и Django 1.11.