AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题

问题[django](ubuntu)

Martin Hope
Huzaifa Zahoor
Asked: 2020-10-14 22:44:33 +0800 CST

Django crontab 没有运行,即使我设置了一切

  • 5

我在 django 中使用 crontab,我的操作系统是 ubuntu

def my_scheduled_job():
    print("1")

这是 settings.py 中的代码

CRONJOBS = [
    ('*/1 * * * *', 'stocks.cron.my_scheduled_job')
]

如果我跑

python3 manage.py crontab 运行#with hash

它运行该功能并打印它,但是当我运行服务器时它不运行。我应该怎么办。

这是我在 crontab 中的代码

    crontab -e
*/1 * * * * /usr/bin/python3 /home/stockstelegraph/manage.py crontab run 6b918d2422a9f4fce735a3383cee6485 # django-cronjobs
python cron python3 django
  • 1 个回答
  • 3678 Views
Martin Hope
Todor
Asked: 2020-07-31 04:49:13 +0800 CST

777 文件的权限被拒绝

  • 6

我有一个Django配置为将数据库查询写入/tmp/db.log文件的应用程序。

        "debug_console_to_file": {
            "level": "DEBUG",
            "filters": ["require_debug_true"],
            "class": "logging.FileHandler",
            "filename": "/tmp/db.log",
        },

应用程序通常从以用户身份uwsgi使用的服务器启动www-data。python manage.py但是,有时我通过我的用户手动运行它(使用) - tvelichkov。

问题是,当我尝试从我的用户启动它时,我收到一个 Permission denied 错误,/tmp/db.log因为www-data已经创建了它(删除文件可以临时解决问题,但是服务器将收到相同的错误,因为现在我用户拥有该文件)。

    PermissionError: [Errno 13] Permission denied: '/tmp/db.log'

我试图将我的用户添加到www-data组

    $ members www-data
    www-data tvelichkov

我还尝试为777文件授予文件权限。

    $ ls -l /tmp/db.log 
    -rwxrwsrwx 1 www-data www-data 22102 юли 30 15:25 /tmp/db.log

但我仍然不断收到这个Permission denied错误。任何帮助,将不胜感激。

注意:我以前在 Ubuntu 18.04 中对这个设置没有任何问题,但现在我在 Ubuntu 20.04 中有它。

更新:这是该/tmp/文件夹的权限,但请注意,这是在我运行之后chown root:root /tmp并且chmod 777 /tmp正如@adrian vera 所建议的那样,顺便说一句,在此更改之后似乎chmod 777 /tmp/db.log正在工作,因为我不再收到 Permission denied 错误。Ubuntu 是否有可能/tmp/在 18.04 和 20.04 版本之间更改了文件夹的内容?因为我很确定在遇到此问题之前我没有对此文件夹进行任何更改?

    $ ls -l / | grep tmp
    drwxrwxrwx  24 root root       4096 авг  3 10:19 tmp

注意 2:我还有一台安装了干净的 Ubuntu 20.04 的机器,我也遇到了这个问题,回家后我也会仔细检查那里的权限。

UPDATE2:所以在干净的 Ubuntu 20.04 上安装/tmp/文件夹的权限是:

    $ ls -l / | grep tmp
    drwxrwxrwt  23 root root      12288 авг  3 16:41 tmp

这就是它的/tmp/db.log样子:

    $ ls -l /tmp/db.log 
    -rw-r--r-- 1 www-data www-data 0 авг  3 16:54 /tmp/db.log

    $ sudo chmod 777 /tmp/db.log 
    $ ls -l /tmp/db.log 
    -rwxrwxrwx 1 www-data www-data 0 авг  3 16:54 /tmp/db.log

    $ lsattr /tmp/db.log 
    --------------e----- /tmp/db.log

    $ whoami
    tvelichkov

    $ getent group www-data
    www-data:x:33:tvelichkov

    $ python manage.py test --settings=cs.settings.test
    Traceback (most recent call last):
      File "/home/tvelichkov/.pyenv/versions/3.6.10/lib/python3.6/logging/config.py", line 565, in configure
        handler = self.configure_handler(handlers[name])
      File "/home/tvelichkov/.pyenv/versions/3.6.10/lib/python3.6/logging/config.py", line 738, in configure_handler
        result = factory(**kwargs)
      File "/home/tvelichkov/.pyenv/versions/3.6.10/lib/python3.6/logging/__init__.py", line 1032, in __init__
        StreamHandler.__init__(self, self._open())
      File "/home/tvelichkov/.pyenv/versions/3.6.10/lib/python3.6/logging/__init__.py", line 1061, in _open
        return open(self.baseFilename, self.mode, encoding=self.encoding)
    PermissionError: [Errno 13] Permission denied: '/tmp/db.log'
permissions log django
  • 2 个回答
  • 4088 Views
Martin Hope
sogu
Asked: 2020-03-27 08:00:27 +0800 CST

nginx 失败,而网站仍然可以正常工作

  • 0

描述

  • 我根据本指南构建了我的 Django3、gunicorn、nginx、Ubuntu 18.04、Digital Ocean 项目。我只有一个问题,它不显示 CSS 和所有其他静态文件,如图像。在整个指南之前,nginx 已经按照指南所说的给出了正确的答案,而且目前 html 站点仍然在线并正在运行
  • 为了解决这个问题,我正在使用另一个指南来让我的静态文件显示在我的网站上。我已经完成了创建者推荐的所有步骤,但在

我试过的

  • 在以下 [1.2.3...] 命令的每个步骤之后,我执行了以下命令来刷新:

    • python3 manage.py collectstatic
    • sudo nginx -t && sudo systemctl restart nginx
    • sudo systemctl restart gunicorn
  • 1.运行:sudo ln -s /etc/nginx/sites-available/ch-project /etc/nginx/sites-enabled

  • 1.结果:ln: failed to create symbolic link '/etc/nginx/sites-enabled/ch-project': File exists

  • 2.运行:/etc/nginx/sites-enabled/my-project

  • 2.结果:-bash: /etc/nginx/sites-enabled/my-project: Permission denied

  • 3.运行:systemctl status nginx.service

  • 3.结果:
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2020-03-26 13:27:08 UTC; 13s ago
     Docs: man:nginx(8)
  Process: 11111 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
  Process: 11111 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
 Main PID: 11111 (code=exited, status=0/SUCCESS)
  • 4.运行:sudo nginx -t
  • 4.结果:
nginx: [emerg] open() "/etc/nginx/sites-enabled/myproject" failed (2: No such file or directory) in /etc/nginx/nginx.conf:62
nginx: configuration file /etc/nginx/nginx.conf test failed
    1. 否则 Nginex 应该没问题,因为网站上的 html 加载并运行良好。这个堆栈溢出帖子说我也许应该对安全性做一些事情,nginx.conf但在那种情况下,他们谈论的是一个 worldpres 网站,所以我不知道如何在这里实现它。
    1. 我之前尝试过这个堆栈溢出帖子的答案,下面是它有一个子帖子来进一步配置 RUN 的答案:sudo nginx -c /etc/nginx/sites-enabled/default -t
  • 6.结果:
nginx: [emerg] "server" directive is not allowed here in /etc/nginx/sites-enabled/default:21
nginx: configuration file /etc/nginx/sites-enabled/default test failed
python nginx django 18.04
  • 1 个回答
  • 1006 Views
Martin Hope
curt
Asked: 2020-03-05 13:12:27 +0800 CST

Django 项目使用 runserver 运行,但不使用 Gunicorn 和 nginx

  • 1

我在带有 ubuntu 18.04.3(LTS) 的 Digital Ocean 液滴上安装了一个 django 项目。我已经安装了 python 3 和 Django 3。在我的虚拟环境中,命令 python --version 返回 3.6.9 命令 django-admin --version 返回 3.0.4。

当我尝试通过浏览器访问 django 时,出现未知导入名称路径错误。我知道这仅在 django 的更高版本中可用。真正的问题是错误页面给出了 2.7.17 的 python 版本和 1.11.11 的 django 版本。我正在使用 gunicorn 和 nginx。写完之后,我突然想到要重新使用 manage.py runserver 0.0.0.0:8000。该项目提出没有错误。如何让 gunicorn 和 nginx 运行我的环境版本的 python 和 django?

为了设置 gunicorn,我使用了 Digital Ocean 文章中关于设置 django 站点的分步脚本。

nginx -v 返回:nginx版本:nginx/1.14.0(Ubuntu)

gunicorn -v 返回:gunicorn(版本 19.7.1)

gunicorn.socket:

[Unit]
Description=gunicorn socket

[Socket]
ListenStream=/run/gunicorn.sock

[Install]
WantedBy=sockets.target

gunicorn.service

[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target

[Service]
User=me
Group=www-data
WorkingDirectory=/home/me/xyzdir
ExecStart=/usr/bin/gunicorn \
      --access-logfile - \
      --workers 3 \
      --bind unix:/run/gunicorn.sock \
      xyz.wsgi:application

[Install]
WantedBy=multi-user.target

nginx.conf

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;

##
# SSL Settings
##

ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;

##
# Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

##
# Gzip Settings
##

gzip on;

# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

##
# Virtual Host Configs
##

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
nginx python3 django
  • 2 个回答
  • 1317 Views
Martin Hope
黒성배
Asked: 2019-12-15 05:16:30 +0800 CST

对于每个框架新的 Python 环境?

  • 3

我对 Linux 很陌生,所以我可能更多地以 Windows 的方式思考。

我想用 Python 开发一些东西,尤其是 Django 和 Discord Bot。我有一个文件夹PythonEnvironment,我在其中设置了一个名为pyvenv. 现在我想安装“discord.py”并问自己:我应该为discord.py它自己的 Venv(例如discordvenv)和 Django 设置它自己的 Venv(例如djangovenv),还是只在一个 Venv 中安装所有东西?

当我安装了我需要的所有东西时,我可以像在 Windows 中一样开始在 PyCharm 中编程,还是我必须做更多的事情,例如告诉 Pycharm 在特定的 Venv 中工作?

python django virtualenv
  • 1 个回答
  • 170 Views
Martin Hope
Demid Cerkov
Asked: 2019-11-11 08:12:47 +0800 CST

Django + Guncorn + nginx:111:连接被拒绝;错误的网关 502

  • 1

由于某种原因,它不起作用。您在此代码中看到任何问题吗?提前感谢您的评论!

错误日志:

2019/11/10 18:02:02 [error] 8761#8761: *1 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: demid.com, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "127.0.0.1"

终端:

demid@demid-Aspire-7736:~$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
demid@demid-Aspire-7736:~$ systemctl daemon-reload
demid@demid-Aspire-7736:~$ systemctl restart gunicorn.socket gunicorn.service nginx.service; systemctl status gunicorn.socket gunicorn.service nginx.service
Failed to dump process list, ignoring: No such file or directory
● gunicorn.socket - gunicorn socket
   Loaded: loaded (/etc/systemd/system/gunicorn.socket; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-11-10 17:59:39 EET; 288ms ago
   Listen: /run/gunicorn.sock (Stream)
   CGroup: /system.slice/gunicorn.socket

lapkr. 10 17:59:39 demid-Aspire-7736 systemd[1]: Listening on gunicorn socket.

● gunicorn.service - gunicorn daemon
   Loaded: loaded (/etc/systemd/system/gunicorn.service; disabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-11-10 17:59:39 EET; 213ms ago
 Main PID: 8756 (gunicorn)
    Tasks: 1 (limit: 4669)
   CGroup: /system.slice/gunicorn.service
           └─8756 /home/demid/myprojectdir/myprojectenv/bin/python3 /home/demid/myprojectdir/myprojectenv/bin/gunicorn

lapkr. 10 17:59:39 demid-Aspire-7736 systemd[1]: Started gunicorn daemon.

● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-11-10 17:59:39 EET; 70ms ago
     Docs: man:nginx(8)
Process: 8757 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, 
  Process: 8759 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 8758 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 8760 (nginx)
    Tasks: 3 (limit: 4669)
   CGroup: /system.slice/nginx.service
           ├─8760 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
           ├─8761 nginx: worker process
           └─8762 nginx: worker process

lapkr. 10 17:59:39 demid-Aspire-7736 systemd[1]: Starting A high performance web server and a reverse proxy server...
lapkr. 10 17:59:39 demid-Aspire-7736 systemd[1]: Started A high performance web server and a reverse proxy server.

/etc/nginx/conf.d/demid.com.conf

server {
    listen         80 default_server;
    listen         [::]:80 default_server;
    server_name    demid.com;
    location = /favicon.ico {access_log off; log_not_found off;}
    location /static/ {
root /demid/myprojectdir;
    }

    location / {
include proxy_params;
#proxy_set_header Host $http_host;
#    proxy_set_header X-Real-IP $remote_addr;
#    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#    proxy_set_header X-Forwarded-Proto $scheme;
    #proxy_pass http://unix:/home/sammy/myproject/myproject.sock;
proxy_pass http://unix:/run/gunicorn.sock;
}
}

/etc/systemd/system/gunicorn.service

[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After = network.target

[Service]
User=root
Group=www-data
WorkingDirectory=/home/demid/myprojectdir
ExecStart=/home/demid/myprojectdir/myprojectenv/bin/gunicorn \
--access-logfile - \
--workers 3 \
--bind unix:/run/gunicorn.sock \
myproject.wsgi:application

[Install]
WantedBy=multi-user.target

/etc/nginx/nginx.conf

worker_processes auto;
worker_rlimit_nofile 50000;

events {
    worker_connections  1024;
    use epoll;
    multi_accept on;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;

    keepalive_timeout  65;
    keepalive_requests 256;
    reset_timedout_connection on;

    gzip  on;
    gzip_vary on;
    gzip_proxied any;
    gzip_min_length 1000;
    gzip_types text/plain text/xml text/css text/javascript application/x-javascript application/json application/xml application/xml+rss image/png image/gif image/jpeg image/jpg;

    open_file_cache max=50000 inactive=20s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 2;

    client_max_body_size 512m;

    server_tokens off;

    include /etc/nginx/conf.d/*.conf;
}
django
  • 1 个回答
  • 6019 Views
Martin Hope
Magofoco
Asked: 2019-08-29 11:45:20 +0800 CST

pam_unix(sudo:auth):身份验证失败 - 重新启动 apache2

  • 0

我正在 Linode 上的 Linux 虚拟机(Ubuntu 19)上部署我的网站。

我的部署在允许时工作:xx.xx.xx.xx:8000

为了允许 HTTP/TCP 流量,我做了:

sudo delete allow 8000
sudo allow http/tcp

当我运行时:

sudo service apache2 restart

我得到:

Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.

所以如果我运行:

journalctl -xe

我得到:

Aug 28 18:52:06 django-server sudo[14724]: pam_unix(sudo:auth): authentication failure; logname=ucluser uid=1000 euid=0 tty=/dev/pts/2 ruser=ucluser rhost=  user=ucluser
Aug 28 18:52:30 django-server sshd[14529]: Received disconnect from 109.175.190.135 port 50098:11: disconnected by user
Aug 28 18:52:30 django-server sshd[14529]: Disconnected from user ucluser 109.175.190.135 port 50098
Aug 28 18:56:49 django-server sshd[14705]: Received disconnect from 109.175.190.135 port 50197:11: disconnected by user
Aug 28 18:56:49 django-server sshd[14705]: Disconnected from user ucluser 109.175.190.135 port 50197
Aug 28 19:27:40 django-server sshd[17050]: Received disconnect from 109.175.190.135 port 50366:11: disconnected by user
Aug 28 19:27:40 django-server sshd[17050]: Disconnected from user ucluser 109.175.190.135 port 50366

我认为问题出在这里:

**Aug 28 18:52:06 django-server sudo[14724]: pam_unix(sudo:auth): authentication failure; logname=ucluser uid=1000 euid=0 tty=/dev/pts/2 ruser=ucluser rhost=  user=ucluser**

但我不知道如何解决它

如果我运行:

apachectl stop

我得到:

apache2: Syntax error on line 225 of /etc/apache2/apache2.conf: Syntax error on line 50 of /etc/apache2/sites-enabled/django_project.conf: Expected </Directory> but saw </VirtualHost>
Action 'stop' failed.
server apache2 django
  • 1 个回答
  • 3831 Views
Martin Hope
SeemsToBeStuck
Asked: 2019-08-08 14:50:30 +0800 CST

PyCharm Pro ImportError 和 Broken Virtualenv

  • 0

问题:解决方案是卸载 virtualenv。

当我试图设置一个Django Project. 在manage.py:

ImportError("Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? `Did you "`
"forget to activate a virtual environment?"

) from exc

更新:我跑virtualenv cmd进来Pycharm Pro terminal 了:

You must provide a DEST_DIR
Usage: virtualenv [OPTIONS] DEST_DIR

安装并virtualenv安装。

python django pycharm
  • 2 个回答
  • 1577 Views
Martin Hope
mehdi
Asked: 2019-08-02 04:25:27 +0800 CST

将复杂文本写入文件(包括双引号和单引号)

  • 0

我想在python中将一个复杂的字符串写入一个文件,但问题是我的文本本身也有一个命令、双引号和单引号,所以python不能写它并假设它也是一个命令。例如,我想将以下文本写入 file.txt:

(b'[{\n  "SourceFile": "/home/parsezan/work/hamclaasy-backend/media/3da78f6d-73a0-41d0-bca6-9b237ba13cdd/4550af6d-ac08-4d22-a80c-681bd171d295.jpg",\n  "ExifToolVersion": 10.80,\n  "FileName": "4550af6d-ac08-4d22-a80c-681bd171d295.jpg",\n  "Directory": "/home/parsezan/work/hamclaasy-backend/media/3da78f6d-73a0-41d0-bca6-9b237ba13cdd",\n  "FileSize": "112 kB",\n  "FileModifyDate": "2019:08:01 16:42:27+04:30",\n  "FileAccessDate": "2019:08:01 16:42:27+04:30",\n  "FileInodeChangeDate": "2019:08:01 16:42:27+04:30",\n  "FilePermissions": "rw-r--r--",\n  "FileType": "JPEG",\n  "FileTypeExtension": "jpg",\n  "MIMEType": "image/jpeg",\n  "JFIFVersion": 1.01,\n  "ExifByteOrder": "Big-endian (Motorola, MM)",\n  "Make": "HUAWEI",\n  "Model": "CHM-U01",\n  "Orientation": "Horizontal (normal)",\n  "XResolution": 72,\n  "YResolution": 72,\n  "ResolutionUnit": "inches",\n  "Software": "CHM-U01 V100R001C185B120",\n  "ModifyDate": "2019:07:07 11:33:18",\n  "YCbCrPositioning": "Centered",\n  "DocumentName": "",\n  "ExposureTime": "1/30",\n  "FNumber": 2.0,\n  "ExposureProgram": "Program AE",\n  "ISO": 260,\n  "ExifVersion": "0210",\n  "DateTimeOriginal": "2019:07:07 11:33:18",\n  "CreateDate": "2019:07:07 11:33:18",\n  "ComponentsConfiguration": "Y, Cb, Cr, -",\n  "ShutterSpeedValue": "1/30",\n  "ApertureValue": 2.0,\n  "BrightnessValue": 0,\n  "ExposureCompensation": 0,\n  "MeteringMode": "Average",\n  "LightSource": "Daylight",\n  "Flash": "Auto, Did not fire",\n  "FocalLength": "3.8 mm",\n  "MakerNoteUnknownText": "M[64] [e0,1] [ad,f5]",\n  "UserComment": "Hisilicon Balong",\n  "SubSecTime": 506779,\n  "SubSecTimeOriginal": 506779,\n  "SubSecTimeDigitized": 506779,\n  "FlashpixVersion": "0100",\n  "ColorSpace": "sRGB",\n  "ExifImageWidth": 4160,\n  "ExifImageHeight": 3120,\n  "InteropIndex": "R98 - DCF basic file (sRGB)",\n  "InteropVersion": "0100",\n  "SensingMethod": "One-chip color area",\n  "FileSource": "Digital Camera",\n  "SceneType": "Directly photographed",\n  "CustomRendered": "Custom",\n  "ExposureMode": "Auto",\n  "WhiteBalance": "Auto",\n  "DigitalZoomRatio": 1,\n  "FocalLengthIn35mmFormat": "27 mm",\n  "SceneCaptureType": "Standard",\n  "GainControl": "None",\n  "Contrast": "Normal",\n  "Saturation": "Normal",\n  "Sharpness": "Normal",\n  "SubjectDistanceRange": "Unknown",\n  "OffsetSchema": 60,\n  "DeviceSettingDescription": "(Binary data 4 bytes, use -b option to extract)",\n  "Compression": "JPEG (old-style)",\n  "ThumbnailOffset": 1134,\n  "ThumbnailLength": 6358,\n  "ImageWidth": 800,\n  "ImageHeight": 600,\n  "EncodingProcess": "Baseline DCT, Huffman coding",\n  "BitsPerSample": 8,\n  "ColorComponents": 3,\n  "YCbCrSubSampling": "YCbCr4:2:0 (2 2)",\n  "Aperture": 2.0,\n  "ImageSize": "800x600",\n  "Megapixels": 0.480,\n  "ScaleFactor35efl": 7.1,\n  "ShutterSpeed": "1/30",\n  "SubSecCreateDate": "2019:07:07 11:33:18.506779",\n  "SubSecDateTimeOriginal": "2019:07:07 11:33:18.506779",\n  "SubSecModifyDate": "2019:07:07 11:33:18.506779",\n  "ThumbnailImage": "(Binary data 6358 bytes, use -b option to extract)",\n  "CircleOfConfusion": "0.004 mm",\n  "FOV": "67.4 deg",\n  "FocalLength35efl": "3.8 mm (35 mm equivalent: 27.0 mm)",\n  "HyperfocalDistance": "1.70 m",\n  "LightValue": 5.5\n}]\n', None)"

我尝试:

    result = 'echo "{result}" >> file.txt'.format(result=str(raw_result))
    subprocess.Popen(result,
                          stdout=subprocess.PIPE,
                          stderr=subprocess.STDOUT,
                          shell=True)

然后尝试将其更改为 dic:

    result = 'echo "{result}" >> /home/parsezan/work/django.txt'.format(result=str({'result': str(raw_result)}))
    subprocess.Popen(result,
                          stdout=subprocess.PIPE,
                          stderr=subprocess.STDOUT,
                          shell=True)

但没有人不工作。有什么想法吗?谢谢

command-line python bash django
  • 1 个回答
  • 502 Views
Martin Hope
SeemsToBeStuck
Asked: 2019-06-02 13:35:01 +0800 CST

Mkvirtualenv:找不到命令 19.04

  • 0

正在尝试安装Django Framework。当我第一次尝试激活虚拟环境时:

mkvirtualenv test
mkvirtualenv: command not found

安装位置:

which virtualenvwrapper.sh
/usr/local/bin/virtualenvwrapper.sh

安装时我没有使用的研究更新sudo。这是教程一和教程二。

python3 django pip virtualenvwrapper
  • 2 个回答
  • 5386 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve