小编Luk*_*urn的帖子

在Heroku django应用程序中添加web dynos时如何克服'Coud not found the formation'错误?

我正在尝试部署一个简单的django应用程序,并已成功将我的git存储库推送到Heroku.但是,当我尝试运行时:

heroku ps:scale web=1
Run Code Online (Sandbox Code Playgroud)

我收到以下错误

Scaling dynos... failed
 !    Couldn't find that formation.
Run Code Online (Sandbox Code Playgroud)

关于问题可能是什么的任何想法?据我所知,Procfile(下面)的内容是正确的.

web: gunicorn my_app_name.wsgi
Run Code Online (Sandbox Code Playgroud)

django heroku

34
推荐指数
4
解决办法
2万
查看次数

为什么.domain,tickFormat和tickValues在维度变量中无法识别?(d3,平行坐标)

我正在使用d3.js创建一个平行坐标图,但我正在努力按照我的意愿格式化轴标记.

例如,我的一个轴"缓冲浓度"是在对数刻度上绘制的,我通过维度变量指定了它,就像这样.

var dimensions = [
  ...
  {
    key: "b.Conc",
    description: "Buffer Concentration",
    type: types["Number"],
    scale: d3.scale.log().domain([.1, 100]).range([innerHeight, 0]),
    tickValues: [.1,.2,.4,.6,.8,1,2,4,6,8,10,20,40,60],
    tickFormat: d3.format(4,d3.format(",d"))
  },
  ...
];
Run Code Online (Sandbox Code Playgroud)

但是,正如您从下面的结果图中可以看到的那样,我尝试指定哪些刻度标签显示(通过tickValues)并且它们显示为普通数字而不是10(通过tickFormat)的功率不起作用.此外,轴不跨越我指定的域scale; 它应该是[0.1,100],而不是[0.1,60].

为什么是这样?

平行坐标图部分

我的情节的data.csv,index.html和style.css文件可以在这里找到.在本地打开时,它[仅]在Firefox中有效.

在此先感谢您的帮助,如果我遗漏了一些基本的东西,我会道歉 - 我是d3的新手.

javascript plot d3.js

8
推荐指数
1
解决办法
162
查看次数

如何在Heroku上安装LaTeX类?

我在Heroku上托管了Django应用。在其中,我使用LaTeX编写的视图即时生成pdf,并安装了Heroku LaTeX buildpack以使其正常工作。我的LaTeX视图如下。

def pdf(request):
    context = {}
    template = get_template('cv/cv.tex')
    rendered_tpl = template.render(context).encode('utf-8')  
    with tempfile.TemporaryDirectory() as tempdir:
        process = Popen(
            ['pdflatex', '-output-directory', tempdir],
            stdin=PIPE,
            stdout=PIPE,
        )
        out, err = process.communicate(rendered_tpl)
        with open(os.path.join(tempdir, 'texput.pdf'), 'rb') as f:
           pdf = f.read()
    r = HttpResponse(content_type='application/pdf')  
    r.write(pdf)
    return r
Run Code Online (Sandbox Code Playgroud)

当我使用在现有的文档类的一个能正常工作cv.tex(例如\documentclass{article}),但我想用一个自定义,叫做res。通常,我相信使用自定义类有两种选择。

  1. 将类文件(res.cls在本例中为)放置在与该.tex文件相同的文件夹中。对我来说,那应该在我应用程序的templates文件夹中。我已经尝试过了,但是pdflatex找不到类文件。(大概是因为它不在模板文件夹中运行,而是在临时目录中运行?是否可以将类文件复制到临时目录中?)

  2. 将类文件放在具有该结构的另一个文件夹中localtexmf/tex/latex/res.cls,并pdflatex使用对此问题的答案中概述的方法进行识别。我尝试使用来在Heroku上运行CLI指令heroku run bash,但它不能识别initexmf,而且我不确定如何指定相关目录。

我如何知道pdflatex在哪里可以找到课程文件?

django latex heroku django-templates pdflatex

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

在Python,ASP.NET中读取和返回jpg文件?

我有一个image.asp使用Python 的文件,我试图打开一个JPEG图像并将其写入响应,以便可以从相关链接中检索它.我目前有什么:

<%@ LANGUAGE = Python%>
<%

path = "path/to/image.jpg"

with open(path, 'rb') as f:
    jpg = f.read()

Response.ContentType = "image/jpeg"

Response.WriteBinary(jpg)

%>
Run Code Online (Sandbox Code Playgroud)

在浏览器中,这将返回以下错误:

The image "url/to/image.asp" cannot be displayed because it contains errors.
Run Code Online (Sandbox Code Playgroud)

我怀疑问题是我只是没有正确地写jpg文件的内容.我需要修理什么?

python asp.net jpeg

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

标签 统计

django ×2

heroku ×2

asp.net ×1

d3.js ×1

django-templates ×1

javascript ×1

jpeg ×1

latex ×1

pdflatex ×1

plot ×1

python ×1