小编Pap*_*nho的帖子

针对passenger_root的Nginx未知指令

我尝试重新启动服务器时遇到错误.我不知道如何解决这个问题.

deploy@user:~$ sudo nginx -s reload
nginx: [emerg] unknown directive "passenger_root" in /etc/nginx/nginx.conf:66
Run Code Online (Sandbox Code Playgroud)

我将这些行添加到nginx配置文件'/etc/nginx/nginx.conf'

passenger_root /home/deploy/.rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.37;
passenger_ruby /home/deploy/.rvm/gems/ruby-2.0.0-p353/wrappers/ruby;
Run Code Online (Sandbox Code Playgroud)

passenger nginx

16
推荐指数
3
解决办法
2万
查看次数

如何将postgis连接到docker中的django

您好我想知道如何使用Docker将POSTGIS连接到django.我有一个错误could not open extension control file "/usr/share/postgresql/10/extension/postgis.control": No such file or directory

产量

root@localhost:~/try-geodjango# docker-compose run web python manage.py migrate
Starting try-geodjango_db_1 ... done
/usr/local/lib/python3.5/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
  """)
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/django/db/backends/utils.py", line 62, in execute
    return self.cursor.execute(sql)
psycopg2.OperationalError: could not open extension control file "/usr/share/postgresql/10/extension/postgis.control": No such file or …
Run Code Online (Sandbox Code Playgroud)

django geodjango docker

16
推荐指数
1
解决办法
2130
查看次数

lxml.etree.XML Unicode字符串的ValueError

我正在使用xslt转换xml文档.使用python3时,我遇到了以下错误.但我对python2没有任何错误

-> % python3 cstm/artefact.py
Traceback (most recent call last):
  File "cstm/artefact.py", line 98, in <module>
    simplify_this_dataset('fisheries-service-des-peches.xml')
  File "cstm/artefact.py", line 85, in simplify_this_dataset
    xslt_root = etree.XML(xslt_content)
  File "lxml.etree.pyx", line 3012, in lxml.etree.XML (src/lxml/lxml.etree.c:67861)
  File "parser.pxi", line 1780, in lxml.etree._parseMemoryDocument (src/lxml/lxml.etree.c:102420)
ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.

#!/usr/bin/env python3
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
# -*- coding: utf-8 -*-

from lxml import etree

def simplify_this_dataset(dataset):
    """Create A simplify …
Run Code Online (Sandbox Code Playgroud)

python unicode python-3.x python-3.4

12
推荐指数
3
解决办法
2万
查看次数

Django设置未知参数:TEMPLATE_DEBUG

嗨,我正在关注djangoproject网站上的教程,我在localhost上收到错误说:

Unknown parameters: TEMPLATE_DEBUG
Run Code Online (Sandbox Code Playgroud)

我的settings.py看起来像这样:

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'TEMPLATE_DEBUG':True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]
Run Code Online (Sandbox Code Playgroud)

我在TEMPLATE上添加了'TEMPLATE_DEBUG',否则我收到以下警告

?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your default TEMPLATES dict: TEMPLATE_DEBUG.
Run Code Online (Sandbox Code Playgroud)

我的模板文件夹在我的应用程序中,即:

my_project_name/polls/templates/polls/index.html
Run Code Online (Sandbox Code Playgroud)

python django django-1.9

12
推荐指数
1
解决办法
2708
查看次数

删除:'/etc/apt/sources.list.d/passenger.list'

我使用Rails并且每次我生成一个命令(即rails生成脚手架文章)

我在脚手架的末尾有这个输出:

〜/ Documents/programming/rails_book/beginning_rails_3/blog3_2_11 $ body:text published_at:datetime --skip-migration警告:root:无法打开文件'/etc/apt/sources.list.d/passenger.list'

我记得今天早上我通过intalling(passenger-install-apache2-module)遇到了乘客(doc)的一些问题

Create a file /etc/apt/sources.list.d/passenger.list and insert one of the following lines, depending on your distribution. 
Run Code Online (Sandbox Code Playgroud)

我想知道删除此输出?

linux ruby-on-rails passenger

11
推荐指数
1
解决办法
4568
查看次数

中间人控制台:如何使用它?

我想知道如何使用middleman console.这是一个简单的irb吗?我能用它做什么与简单的irb不同?

middleman console [options]         # Start an interactive console in the cont...
Run Code Online (Sandbox Code Playgroud)

我有一些文章,我尝试做,Article.all但我有以下错误:

NameError: uninitialized constant Middleman::Application::MiddlemanApplication1::Article
    from (irb#1):1
Run Code Online (Sandbox Code Playgroud)

我也有本地数据 /data/friends.json但Friend.all输出错误.

{
  "friends": [
    "Tom",
    "Dick",
    "Harry"
  ]
}
Run Code Online (Sandbox Code Playgroud)

我看到Symbol.all_symbols输出了很多中间变量和函数,但我真的不知道如何使用中间人控制台.

middleman

10
推荐指数
1
解决办法
1571
查看次数

cvs2json无法加载这样的文件 - orderedhash

我正在尝试使用这个gem:csv2json(0.3.0),我收到了一个错误.

在我的档案essaie.rb:

require 'csv2json'

File.open('essaie.csv', 'r') do |input|
    File.open('output.json', 'w') do |output|
        CSV2JSON.parse(input, output)
    end
end


user@user-ThinkPad-L430:~/development/public/opendata/other$ ruby essaie.rb 
/home/user/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- orderedhash (LoadError)
    from /home/user/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/user/.rvm/gems/ruby-2.1.0/gems/csv2json-0.3.0/lib/csv2json.rb:4:in `<top (required)>'
    from /home/user/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require'
    from /home/user/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
    from /home/user/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
    from essaie.rb:1:in `<main>'
Run Code Online (Sandbox Code Playgroud)

当我删除版本0.3.0(csv2json)并且我安装了以前的版本时,我收到此错误:

user@user-ThinkPad-L430:~/development/public/opendata/other$ ruby essaie.rb 
/home/user/.rvm/gems/ruby-2.1.0/gems/csv2json-0.2.0/lib/csv2json.rb:17:in `initialize': wrong number of arguments (2 for 0) (ArgumentError)
    from /home/user/.rvm/gems/ruby-2.1.0/gems/csv2json-0.2.0/lib/csv2json.rb:17:in `new'
    from /home/user/.rvm/gems/ruby-2.1.0/gems/csv2json-0.2.0/lib/csv2json.rb:17:in `parse'
    from essaie.rb:5:in `block (2 levels) in <main>'
    from essaie.rb:4:in …
Run Code Online (Sandbox Code Playgroud)

ruby gem

7
推荐指数
1
解决办法
1010
查看次数

创建word文档时出现python-docx style_id错误

我正在按照python-docx网站上提供的教程创建一个MS-Word文档但是我收到一个错误:

M:\Sites>python word.py
C:\Program Files\IBM\SPSS\Statistics\22\Python\lib\site-packages\docx\styles\sty
les.py:54: UserWarning: style lookup by style_id is deprecated. Use style name a
s key instead.
  warn(msg, UserWarning)
Run Code Online (Sandbox Code Playgroud)

word.py

    from docx import Document
    from docx.shared import Inches
    import json

    document = Document()

    document.add_heading('Document Title', 0)

    p = document.add_paragraph('A plain paragraph having some ')
    p.add_run('bold').bold = True
    p.add_run(' and some ')
    p.add_run('italic.').italic = True

    document.add_heading('Heading, level 1', level=1)
    document.add_paragraph('Intense quote', style='IntenseQuote')

    document.add_paragraph(
        'first item in unordered list', style='ListBullet'
    )
    document.add_paragraph(
        'first item in ordered list', …
Run Code Online (Sandbox Code Playgroud)

python ms-word python-2.7 python-docx

6
推荐指数
1
解决办法
3941
查看次数

Cakephp图像 - 不能确定mimetype

cakephp 2.3

我上传了一张图片,但我说错了:

Can not determine the mimetype.

Error: An Internal Error Has Occurred.
Run Code Online (Sandbox Code Playgroud)

在我的模型上,这是我的$ validation的一部分

'file_name' => array(
            'uploadError' => array(
                'rule' =>'uploadError',
                'message' => 'Your image upload failed',
                'allowEmpty' => FALSE,
                //'required' => false,
                //'last' => false, // Stop validation after this rule
                //'on' => 'create', // Limit validation to 'create' or 'update' operations
            ),
            'mimeType' => array(
                'rule' => array('mimeType', array('image/gif', 'image/png', 'image/jpg', 'image/jpeg')),
                'message' => 'Please only upload images (gif, png, jpg).',
                'allowEmpty' => FALSE,
                ), …
Run Code Online (Sandbox Code Playgroud)

cakephp cakephp-2.0 cakephp-2.3

5
推荐指数
1
解决办法
2396
查看次数

rails 4使用没有控制器的强参数

Rails 4:我来自rails 3.2.x我有一个问题.如何在没有控制器的情况下使用Strong参数.

我有这个型号:

Track (the only one that has a Controller  )
  has_many :tracksegments, :dependent => :destroy
  has_many :points, :through => :tracksegments
Tracksegment
  belongs_to :track
  has_many :points, :dependent => :destroy
points
  belongs_to :tracksegment
Run Code Online (Sandbox Code Playgroud)

Track是唯一一个拥有Controller的轨道,因此它具有一些强参数.

我想知道在哪里可以放置属于"tracksegment"和"points"的参数在Rails 3.x中它直接在模型中但在rails 4中我没有控制器.

ruby-on-rails ruby-on-rails-4

5
推荐指数
2
解决办法
1857
查看次数