我正在尝试设置包含一些基本设置的多个设置文件(开发,生产,...).虽然不能成功.当我尝试运行时,./manage.py runserver
我收到以下错误:
(cb)clime@den /srv/www/cb $ ./manage.py runserver
ImproperlyConfigured: The SECRET_KEY setting must not be empty.
Run Code Online (Sandbox Code Playgroud)
这是我的设置模块:
(cb)clime@den /srv/www/cb/cb/settings $ ll
total 24
-rw-rw-r--. 1 clime clime 8230 Oct 2 02:56 base.py
-rw-rw-r--. 1 clime clime 489 Oct 2 03:09 development.py
-rw-rw-r--. 1 clime clime 24 Oct 2 02:34 __init__.py
-rw-rw-r--. 1 clime clime 471 Oct 2 02:51 production.py
Run Code Online (Sandbox Code Playgroud)
基本设置(包含SECRET_KEY):
(cb)clime@den /srv/www/cb/cb/settings $ cat base.py:
# Django base settings for cb project.
import django.conf.global_settings as defaults
DEBUG = False …
Run Code Online (Sandbox Code Playgroud) 这是我的表web_book的方案:
Column | Type | Modifiers
----------------+------------------------+-------------------------------------------------------
id | integer | not null default nextval('web_book_id_seq'::regclass)
page_count | integer | not null
year_published | integer | not null
file | character varying(100) | not null
image | character varying(100) | not null
display_on_hp | boolean | not null
name | character varying(128) | not null
description | text | not null
name_cs | character varying(128) |
name_en | character varying(128) |
description_cs | text |
description_en | text |
Run Code Online (Sandbox Code Playgroud)
该表包含一行id=3 …
我可以看到,如果我像这样启动uwsgi:
sudo /usr/local/bin/uwsgi --emperor /etc/uwsgi/vassals --uid www --gid www
Run Code Online (Sandbox Code Playgroud)
它创造了一个皇帝副本.但是如果我--master
另外启动它(这里推荐),它会创建两个皇帝副本.是否有意义使用--master
与--emperor
?我会说不,但如果我在没有该选项的情况下运行它,我会收到此警告:
*** WARNING: you are running uWSGI without its master process manager ***
是否可以在google-chrome中使用自定义功能,这些功能将始终在控制台中可用(无论加载哪个页面)?例如,我想有一个名为echo的函数,它只是console.log的一个包装器.这只是节省了一些输入,但后来我可能想要创建一些有用的调试功能.
我正在阅读一本关于innodb交易的手册,但仍然有很多不清楚的东西给我.例如,我不太了解以下行为:
-- client 1 -- client 2
mysql> create table simple (col int)
engine=innodb;
mysql> insert into simple values(1);
Query OK, 1 row affected (0.00 sec)
mysql> insert into simple values(2);
Query OK, 1 row affected (0.00 sec)
mysql> select @@tx_isolation;
+-----------------+
| @@tx_isolation |
+-----------------+
| REPEATABLE-READ |
+-----------------+
mysql> begin;
Query OK, 0 rows affected (0.01 sec)
mysql> begin;
Query OK, 0 rows affected (0.00 sec)
mysql> update simple set col=10 where col=1;
Query OK, 1 row affected …
Run Code Online (Sandbox Code Playgroud) 使用此表单:
class Form(forms.Form):
name = forms.CharField(required=False, initial='Hello world')
Run Code Online (Sandbox Code Playgroud)
如果我在视图中执行以下操作:
form = Form(request.GET)
if form.is_valid():
name = form.cleaned_data['name']
Run Code Online (Sandbox Code Playgroud)
然后,即使request.GET不包含name
键,也会丢失name的初始值.有没有解决方法?我希望初始值可以将表单绑定为"默认值".
尝试运行时出现以下错误hg update
:
abort: Operation not permitted:
/var/www/simira/web/public/images/nominations/13/big/4f196667cf5a2.jpg
Run Code Online (Sandbox Code Playgroud)
这是一些信息:
$ cd /var/www/simira/web/public/images/nominations/13/big/
$ ll ./4f196667cf5a2.jpg
-rw-rw-r-- 1 martin portadesign 15356 Feb 2 22:10 4f196667cf5a2.jpg
$ ll -d ./
drwxrwxr-x 2 martin portadesign 4096 Feb 2 22:10 ./
$ id
uid=5004(clime) gid=5007(portadesign) groups=5007(portadesign),10(wheel),48(apache)
Run Code Online (Sandbox Code Playgroud)
告诉我有什么问题,拜托...
我使用select2 jquery插件和magnific弹出窗口.如果我在打开的弹出窗口中单击选择,则会显示包含某些结果的搜索框.问题是无法在搜索框中输入任何内容 - 光标就不会出现.这是jsfiddle,它演示了问题http://jsfiddle.net/clime/qweWa/15/.代码如下:
# html
<a href="#test-popup" class="open-popup-link">Show inline popup</a>
<div id="test-popup" class="white-popup mfp-hide">
<select id="focus-blur-loop-select">
<option>hello</option>
<option>world</option>
</select>
</div>
# js
$(function() {
$('.open-popup-link').magnificPopup({
type:'inline',
midClick: true
});
$('#focus-blur-loop-select').select2({
width: '200px'
});
});
# css
.white-popup {
position: relative;
background: #FFF;
padding: 20px;
width: auto;
max-width: 500px;
margin: 20px auto;
}
Run Code Online (Sandbox Code Playgroud)
我已经完成了一些基础研究,并且我发现下面的两个回调被称为unfinetly.事件中似乎存在一些无限循环.
// select2.js:742
search.on("focus", function () { search.addClass("select2-focused"); });
search.on("blur", function () { search.removeClass("select2-focused");});
Run Code Online (Sandbox Code Playgroud) 以前,我使用了这个查询,速度很快:
cb=# explain analyze SELECT "web_route"."id", "web_crag"."id" FROM "web_route"
INNER JOIN "web_crag" ON ( "web_route"."crag_id" = "web_crag"."id" )
WHERE "web_crag"."type" IN (1, 2)
ORDER BY "web_crag"."name" ASC
LIMIT 20;
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.00..2.16 rows=20 width=18) (actual time=0.027..0.105 rows=20 loops=1)
-> Nested Loop (cost=0.00..47088.94 rows=436055 width=18) (actual time=0.026..0.100 rows=20 loops=1)
-> Index Scan using web_crag_name on web_crag (cost=0.00..503.16 rows=1776 width=14) (actual time=0.011..0.020 rows=14 loops=1)
Filter: (type = ANY ('{1,2}'::integer[]))
-> Index Scan using web_route_crag_id on web_route (cost=0.00..23.27 rows=296 width=8) (actual …
Run Code Online (Sandbox Code Playgroud) 这已经困扰我很长时间了。我喜欢使用wildmenu 在命令模式下浏览目录。问题是,为了进入子目录,我需要使用<down>
总是遥不可及的密钥。我试图做一些映射来克服这个问题,但没有成功。例如:
cnoremap <C-j> <DOWN>
Run Code Online (Sandbox Code Playgroud)
但是,如果我<C-j>
想在wildmenu 中进入子目录时按,则菜单会消失并^I
出现在命令行的末尾。知道如何解决这个问题吗?
django ×2
postgresql ×2
console ×1
forms ×1
innodb ×1
javascript ×1
jquery ×1
mercurial ×1
mysql ×1
optimization ×1
python ×1
settings ×1
sql ×1
transactions ×1
uwsgi ×1
vim ×1