简体   繁体   English

Perl Dancer的初始配置

[英]Perl Dancer initial configuration

I have a fully web site in perl under cgi-bin, but now, at client side, i'll move to MVC all my client stuff.. i decided that would be AJAX heavy with smooth transitions between sections instead of full refreshes. 我在cgi-bin下的perl中有一个完整的网站,但是现在,在客户端,我将所有客户端内容都移到MVC上。.我认为这将是AJAX的重担,各部分之间的平滑过渡而不是完全刷新。

At this point, there is no problem at all. 此时,完全没有问题。

First problem, comes that i want to make an fully perl restapi to clarify things and take the fully advantaged of use backbonejs for example. 第一个问题是,我想制作一个完全perl的restapi来阐明问题,并充分利用use bonesjs的优势。

So, at this point i have somenting like this: 所以,在这一点上,我有这样的想法:

www.foo.com/cgi-bin/home.pl
www.foo.com/cgi-bin/wines.pl

... ...

After reading a lot, i'm thinking to use Dancer, since seems quite simple and fast. 看了很多书后,我正在考虑使用Dancer,因为它看起来非常简单快捷。

My main question after all these lines is simple.. 所有这些行之后,我的主要问题很简单。

Where should i create my project? 我应该在哪里创建我的项目? "Dancer -a App" is it supposed to be created inside cgi-bin? 是否应该在cgi-bin中创建“ Dancer -a App”?

I'm developing under windows machine, but my host is ubuntu, so, could you guys tell me what is the most common directory? 我正在Windows机器上进行开发,但是我的主机是ubuntu,所以,你们能告诉我什么是最常见的目录吗?

After hours trying to work with that, nothing.. still unable.. 经过数小时的尝试,仍然无法完成任何工作。

I can run my app as standalone like "perl bin/MyApp.pl" but in deploying nothing.. 我可以像“ perl bin / MyApp.pl”一样独立运行我的应用程序,但不进行任何部署。

my httpd.conf 我的httpd.conf

<virtualhost *:80>
   ServerName localhost
    DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/MyApp/public/"
    ServerAdmin admin@localhost

    <directory "C:/Program Files/Apache Group/Apache2/htdocs/MyApp/public/">
       AllowOverride None
       Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
       Order allow,deny
       Allow from all
       AddHandler cgi-script .cgi
    </Directory>

ScriptAlias / C:/Program Files/Apache Group/Apache2/htdocs/MyApp/public/dispatch.cgi/

what am i doing wrong? 我究竟做错了什么?

There are different question. 有不同的问题。 Let me see if I can help. 让我看看是否可以帮忙。

Where should i create my project? 我应该在哪里创建我的项目? "Dancer -a App" is it supposed to be created inside cgi-bin? 是否应该在cgi-bin中创建“ Dancer -a App”?

No. Please read http://metacpan.org/pod/Dancer::Deployment how to setup your Dancer environment. 否。请阅读http://metacpan.org/pod/Dancer::Deployment如何设置您的Dancer环境。

I'm developing under windows machine, but my host is ubuntu, so, could you guys tell me what is the most common directory? 我正在Windows机器上进行开发,但是我的主机是ubuntu,所以,你们能告诉我什么是最常见的目录吗?

I do the same, but there is no 'common'. 我也一样,但是没有“共同点”。 Configure your Dancer app on your local system and avoid absolute paths. 在本地系统上配置Dancer应用,并避免使用绝对路径。 Then take the complete app directory to your ubuntu system and run it there. 然后将完整的应用程序目录移至ubuntu系统并在其中运行。

For developing (on windows) I usually use perl bin/app.pl to develop the application. 为了开发(在Windows上),我通常使用perl bin / app.pl来开发应用程序。 On the *nix system I use starman (sometimes behind nginx), but that is all covered in Deployment 在* nix系统上,我使用starman(有时在nginx之后),但是Deployment中涵盖了所有内容

HTH HTH

I usually stick my Dancer project in ~/src/My-Dancer-Proj 我通常将我的Dancer项目粘贴在~/src/My-Dancer-Proj

Then, rather than using cgi, I use fastcgi. 然后,我使用fastcgi而不是cgi。 My httpd.conf looks like this... 我的httpd.conf看起来像这样...

<VirtualHost *:80>
  ServerName myserver.com
  DocumentRoot /home/my_user/src/My-Dancer-Proj/public
  <Directory "/home/my_user/src/My-Dancer-Proj/public">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
    AddHandler fcgid-script .fcgi
  </Directory>

  RewriteEngine On
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /dispatch.fcgi$1 [QSA,L]
</VirtualHost>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM