以下是我的nginx配置文件 /etc/nginx/nginx.conf
user Foo;
worker_processes 1;
error_log /home/Foo/log/nginx/error.log;
pid /home/Foo/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
http {
access_log /home/Foo/log/nginx/access.log;
server {
listen 80;
location = / {
proxy_pass http://192.168.0.16:9999;
}
}
}
Run Code Online (Sandbox Code Playgroud)
如您所见,我将日志,pid文件位置更改为主目录.
当我重新启动Linux它似乎工作,Nginx记录我设置的文件和pid文件中的错误日志.
但是,当它尝试nginx -s reload或其他时,它会尝试打开其他错误日志文件.
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2015/12/14 11:23:54 [warn] 3356#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1 …Run Code Online (Sandbox Code Playgroud) 我想监视系统中的查询时间(内置Django models).
终于我找到了django.db.connection.queries.
它显示了所有查询和时间.
使用这个,我想打印我定期查询的列表,然后我想清除打印后打印的列表.
它似乎有列表对象的方法(pop, remove等等).
但即使我打电话pop(),它没有任何效果,仍然显示相同的长度.
我该如何清除清单..?
或者我的意图还有其他方法吗?
ps我也发现Django-debug-toolbar但它似乎只适用于视图部分.
我知道这些标志适用于Eclipse中的C++ 11.
但我不知道有什么区别,哪一个更受欢迎.
看起来他们都正常使用C++ 11.
我想要scrapy
并且有scrapy shell"URL"命令,使用URL中的响应对象执行控制台ipython.
但我想用笔记本做那件事.
有没有办法用笔记本执行scrapy shell,
或者如何手动在ipython中获取URL的相同响应对象?
我下载了即时Oracle客户端版本11.2.0.4.0( ,,basic 的.rpm文件)由甲骨文网站在Ubuntu.转换成使用后,我安装了它,第一个也是最后一个.sqlplusdevel.rpm.debalienbasicsqlplusdevel
然后我试着运行sqlplus.
但它说 sqlplus64: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory
即使我PATH包含了PATH.
下面显示了我PATH和的位置libsqlplus.so.
A@ubuntu:~$ sudo find / -name libsqlplus.so
/usr/lib/oracle/11.2/client64/lib/libsqlplus.so
A@ubuntu:~$ echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/sangmin/eclipse:/usr/lib/oracle/11.2/client64/lib:/usr/lib/oracle/11.2/client64
Run Code Online (Sandbox Code Playgroud) 当我尝试 sudo add-apt-repository ppa:webupd8team/java
ubuntu终端显示此错误消息.
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 11, in <module>
from softwareproperties.SoftwareProperties import SoftwareProperties
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 27, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 21, in <module>
import apt_pkg
Run Code Online (Sandbox Code Playgroud)
虽然我尝试apt-get install python3-apt但仍然没有工作(我也尝试重新安装后删除),我也试过pip3 install apt-pkg但它说
Downloading/unpacking apt-pkg
Could not find any downloads that satisfy the requirement apt-pkg
No distributions at all found for apt-pkg
Storing complete log in /home/kim/.pip/pip.log
Run Code Online (Sandbox Code Playgroud)
当然,导入apt_pkg也不能在python3中工作(但它在python2.7中工作,我有两个版本的python一个是2.7另一个是3.3)
我怎么能在python3上安装这个包
我已经查看了类似问题的其他问题.
但他们似乎说答案是 git fetch --all.
但就我而言,它不起作用.
这就是我为它所做的.
> git branch
* master
> git branch -r
origin/master
origin/A
> git fetch --all
> git branch
* master #still not updated
> git fetch origin/A
fatal: 'origin/A' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
> git fetch remotes/origin/A
fatal: 'origin/A' does not appear to be a git repository
fatal: …Run Code Online (Sandbox Code Playgroud) 我想改变旋转文件处理程序命名文件的方式。
例如,如果我使用 RotatingFileHandler,它会在达到特定文件大小时将日志文件分开,命名为“日志文件名 + 扩展名编号”,如下所示。
filename.log #first log file
filename.log.1 #rotating log file1
filename.log.2 #rotating log file2
Run Code Online (Sandbox Code Playgroud)
但是,我希望日志处理程序在每次创建时都为它们命名。例如。
09-01-12-20.log #first log file
09-01-12-43.log #rotating log file1
09-01-15-00.log #rotating log file2
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
编辑:
我不是在问如何创建和命名文件。
我想促进 pythonlogging包做一些类似继承和覆盖的事情logging。
这是简单的测试代码和结果.
import asyncio
async def test():
await asyncio.sleep(1)
if __name__ == '__main__':
asyncio.set_event_loop(None) # Clear the main loop.
loop = asyncio.new_event_loop() # Create a new loop.
loop.run_until_complete(test()) # Run coroutine over the new loop
Run Code Online (Sandbox Code Playgroud)
Traceback (most recent call last):
File "test_test.py", line 11, in <module>
loop.run_until_complete(test())
File "/usr/lib/python3.5/asyncio/base_events.py", line 387, in run_until_complete
return future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
raise self._exception
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "test_test.py", line 5, in test
await asyncio.sleep(1)
File …Run Code Online (Sandbox Code Playgroud) 简单地说,thread-safe意味着当多个人thread访问相同的资源并且我知道从根本上Asyncio使用一个时是安全的thread。
但是,不止一个人Asyncio Task可以同时多次访问资源,例如multi-threading.
例如数据库连接(如果对象不是thread-safe并且支持Asyncio操作)。
Task A和Task B访问同一个数据库对象。Task A。Task A await DB对象上的IO操作。(需要很长时间)Task BStep3的 IO 操作仍在进行中(未完成)。Task B await 对同一个 DB 对象的 IO 操作。Task B试图一次访问同一个对象。它是完全Asyncio安全的吗?如果是,它是如何保证安全的?
python ×4
python-3.x ×3
c++ ×1
c++11 ×1
client ×1
config ×1
django ×1
eclipse ×1
event-loop ×1
fetch ×1
git ×1
linux ×1
logging ×1
nginx ×1
oracle11g ×1
python-2.7 ×1
python-3.5 ×1
scrapy ×1
ubuntu ×1
ubuntu-12.04 ×1