我收到了这个错误(1062, "Duplicate entry '0' for key 'PRIMARY'").这是在我将我的Django应用程序从sqlite3迁移到MySQL之后发生的.这是关注的表:
mysql> describe meddy1_specialization;
+-------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(30) | NO | | NULL | |
+-------+-------------+------+-----+---------+----------------+
2 rows in set (0.01 sec)
Run Code Online (Sandbox Code Playgroud)
这是模型:
class Specialization(models.Model):
name = models.CharField(max_length=30)
def __unicode__(self):
return self.name
Run Code Online (Sandbox Code Playgroud)
这是表中的数据:
mysql> select * from meddy1_specialization;
+----+--------------------+
| id | name | …Run Code Online (Sandbox Code Playgroud) 当我尝试为除我的系统默认值之外的python版本设置virtualenv时,我收到此错误:
-sh-4.1$ virtualenv -p /usr/local/bin/python2.7 test
Running virtualenv with interpreter /usr/local/bin/python2.7
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/virtualenv.py", line 8, in <module>
import base64
File "/usr/local/lib/python2.7/base64.py", line 9, in <module>
import struct
File "/usr/local/lib/python2.7/struct.py", line 1, in <module>
from _struct import *
ImportError: No module named _struct
Run Code Online (Sandbox Code Playgroud)
系统是RedHat,默认系统python版本是2.6.6.任何帮助将非常感激.
我想在移动设备上隐藏包含facebook likebox小部件的div.我试过这个,但它不起作用.
div代码:
<div id="facebook" class="fb-like-box mobile-hide" data-href="https://www.facebook.com/mypage" data-width="220" data-height="250" data-show-faces="true" data-stream="false" data-header="true"></div>
Run Code Online (Sandbox Code Playgroud)
css代码:
@media screen and (min-width: 0px) and (max-width: 720px) {
#facebook { display: none; }
.mobile-hide{ display: none; }
}
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?它使用id或类引用不起作用.
我是RedHat的新手,但已经使用Ubuntu了一段时间.我正在尝试使用rpy2 pip install rpy2,我收到错误
/usr/include/features.h:164:1: warning: this is the location of the previous definition
./rpy/rinterface/_rinterface.c:86:31: error: readline/readline.h: No such file or directory
In file included from ./rpy/rinterface/_rinterface.c:122:
./rpy/rinterface/embeddedr.c: In function ‘SexpObject_CObject_destroy’:
./rpy/rinterface/embeddedr.c:68: warning: implicit declaration of function ‘PyCapsule_GetPointer’
./rpy/rinterface/embeddedr.c:69: warning: cast to pointer from integer of different size
./rpy/rinterface/embeddedr.c: In function ‘Rpy_PreserveObject’:
./rpy/rinterface/embeddedr.c:107: warning: implicit declaration of function ‘PyCapsule_New’
./rpy/rinterface/embeddedr.c:109: warning: assignment makes pointer from integer without a cast
./rpy/rinterface/embeddedr.c:122: warning: cast to pointer from integer of different size …Run Code Online (Sandbox Code Playgroud) 我的form_for在我单独使用时起作用:
<h1>Contact Us</h1>
<%= @contact.errors.full_messages.join(', ') %>
<%= form_for @contact do |f| %>
<p>
<%= f.label :name %><br>
<%= f.text_field :name %>
</p>
<p>
<%= f.label :email %><br>
<%= f.text_field :email %>
</p>
<p>
<%= f.label :subject %><br>
<%= f.text_field :subject %>
</p>
<p>
<%= f.label :message %><br>
<%= f.text_area :message %>
</p>
<p>
<%= f.submit 'Submit Query', :class => 'submit-button btn btn-default' %>
</p>
<% end %>
Run Code Online (Sandbox Code Playgroud)
但是,当我使用样式和所有内容将其添加到我的Web应用程序的其余部分时,它将停止工作:
<!-- scrollToTop -->
<!-- ================ -->
<div class="scrollToTop"><i class="icon-up-open-big"></i></div>
<!-- page …Run Code Online (Sandbox Code Playgroud) python ×2
redhat ×2
actionmailer ×1
css ×1
django ×1
duplicates ×1
form-for ×1
hide ×1
html ×1
mobile ×1
mysql ×1
primary-key ×1
r ×1
rpy2 ×1
virtualenv ×1