`
文章列表
Management Commands Haystack comes with several management commands to make working with Haystack easier. clear_index The clear_index command wipes out your entire search index. Use with caution. In addition to the standard management command options, it accepts the following arguments: ``- ...
postgresql默认情况下,远程访问不能成功,如果需要允许远程访问,需要修改两个配置文件,说明如下: cd /etc/postgresql-9.4   (这个目录可能不同) 1.postgresql.conf 将该文件中的listen_addresses项值设定为“*” 2.pg_hba.conf 在该配置文件的host all all 127.0.0.1/32 md5行下添加以下配置,或者直接将这一行修改为以下配置 host    all    all    0.0.0.0/0    md5 也可以设置能内网可以访问 host    all    all   192.16 ...
最近用到postgresql,可是不知道怎么启动,原来linux的启动服务都差不多 例如 service nginx start  (status | stop | restart)   service postgresql-9.3 start  (status | stop | restart)   没有service命令的如下  sudo /etc/init.d/postgresql-9.4 start  (status | stop | restart)

django userena 使用

 
参考  http://docs.django-userena.org/en/latest/installation.html#required-settings   我用的是django1.9.7, userena2.0.1 原来文档的顺序跑不出来, 我跑出来的顺序是 1    pip install django-userena   2   Required settings You need to make some changes Django settings if you want to use Userena in your project. This mean ...

pip 安装源

pipy国内镜像目前有:   http://pypi.douban.com/  豆瓣 http://pypi.hustunique.com/  华中理工大学 http://pypi.sdutlinux.org/  山东理工大学 http://pypi.mirrors.ustc.edu.cn/  中国科学技术大学   对于pip这种在线安装的方式来说,很方便,但网络不稳定的话很要命。使用国内镜像相对好一些,   如果想手动指定源,可以在pip后面跟-i 来指定源,比如用豆瓣的源来安装web.py框架: pip install web.py -i http://pypi.do ...
http://docs.python-guide.org/en/latest/
全部安装好之后   不用python manage.py runserver  而是用uwsgi uwsgi.ini命令, 其中uwsgi.ini是写的uwsgi配置文件, [uwsgi] socket = 127.0.0.1:3031 chdir = /home/david/project wsgi-file = xxx/wsgi.py processes = 4 threads = 2 stats = 127.0.0.1:9191     然后nginx.conf中对应的转发的配置  server{ listen 8080; .. ...
利用.gitignore过滤文件,如编译过程中的中间文件,等等,这些文件不需要被追踪管理。 现象: 在.gitignore添加file1文件,以过滤该文件,但是通过git status查看仍显示file1文件的状态。 原因: 在git库中已存在了这个文件,之前push提交过该文件。 .gitignore文件只对还没有加入版本管理的文件起作用,如果之前已经用git把这些文件纳入了版本库,就不起作用了 解决: 需要在git库中删除该文件,并更新。 git rm 然后再次git status查看状态,file1文件不再显示状态。
从postgres中导出数据到csv中 1  用postgres用户(root)登录postgresql 2 建一个csv文件,并 chmod 7773 在原数据中修改----title中的;改成:(有;的标题在导出到csv中时会被拆分成两列)update article_article set title =  'China’s Copycats: Online vs. Offline.' where id=7939;update article_article set title =  'Web browsers used most in China: how this impact ...
postgresql中的表和mysql中的表结构不一样,过程中做点转换,特别是datetime的insert 还有activated 字段在原表中是布尔型,mysql表中是tinyint型     import psycopg2 import MySQLdb import datetime, time psycopg2_conn = psycopg2.connect( database="expat", user="david", password="1" ...
我是用的qq邮箱 1) 开通qq邮箱的smtp服务,在邮箱的设置中,开通之后会得到一个密码,记下来 2) 编辑laravel项目目录下的.env文件 vim .env MAIL_DRIVER=smtp MAIL_HOST=smtp.qq.com MAIL_PORT=25 MAIL_USERNAME=123456789@qq.com MAIL_PASSWORD=hzppuevkhrqubdcd MAIL_ENCRYPTION=tls 其中MAIL_PASSWORD是开通smtp服务后给到的密码,不是自己qq号的密码   3) 编辑 config/mail.php其中一 ...
之前是用Django,现在需要用Laravel,其实一开始我是拒绝的,我不怎么喜欢php,写惯了python再写php老忘记写分号,还要经常对花括号,引用不是用.而是用->或=>,变量还要加个$,  ...... 总之各种细节真是草尼玛, 工作中要用也没办法  或许习惯了就好点吧,   他们都是MVC框架   Laravel  对比                  Django Eloquent ORM         Models               M views(blade templates)                        templ ...
http://getbootstrap.com/components/#     bootstrap 可以这样居中,刚发现阿 <div class="col-sm-offset-2 col-sm-8">  
比如我有一个imgs表,现在在这个表中添加一个votes字段   php artisan make:migration add_votes_to_imgs_table --table=imgs   然后修改生成的migration文件     public function up()     {         Schema::table('imgs', function (Blueprint $table) {             $table->integer('votes');         });     }   最后php artisan mig ...
axis   >>> b = np.arange(12).reshape(3,4) >>> b array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11]]) >>> >>> b.sum(axis=0) # sum of each column array([12, 15, 18, 21]) >>> >>> b.min(ax ...
Global site tag (gtag.js) - Google Analytics