[erlang-questions] Browser not displaying images from Mochiweb server

Bob Ippolito <>
Sun Sep 27 09:20:30 CEST 2015


URLs are handled by you, in the code that you write. The Erlang code in src
specifies that behavior. I could only guess correctly because I assumed you
had used code similar to what's in the default template.

On Saturday, September 26, 2015, austin aigbe <> wrote:

> Thanks Bob. You are right.
>
> I have moved the "data" folder to priv/www but left the login.dtl file in
> the templates folder.
> The image is now visible.
>
> However, the Mochiweb documentation does not clearly state how to handle
> URL's. How are URL's handled by Mochiweb?
>
>
> :~/fe$ ls -LR
> .:
> bench.sh  deps  ebin  Makefile  priv  rebar  rebar.config  src
>  start-dev.sh  templates
>
> ./priv:
> www
>
> ./priv/www:
> data
>
> ./priv/www/data:
> canvas-tools.js                   exporting.js
>  jquery-2.1.1.min.js
> d3.5.5_dynatrace.js               exportingOffline.js
> jquery.gridster.extras.js
> d3.geo.projection.v0.2.12.min.js  fonts.css
> jquery.gridster.js
> d3map.js                          highcharts-4.0.3.js
> logo_300x175.png
> d3.tip.v0.6.3.js                  highcharts-4.0.3-more.js
>  topojson.v1.6.18.min.js
>
> ./templates:
> login.dtl
>
> BR,
> Austin
>
> On Sat, Sep 26, 2015 at 2:57 PM, Bob Ippolito <
> <javascript:_e(%7B%7D,'cvml','');>> wrote:
>
>> Looks like you aren't putting the files in the right place. Impossible to
>> tell without the code for the server, but the default project template for
>> mochiweb serves static files from priv/www.
>>
>>
>> On Saturday, September 26, 2015, austin aigbe <
>> <javascript:_e(%7B%7D,'cvml','');>> wrote:
>>
>>> Hello,
>>>
>>> My browser is unable to display images from my mochiweb server - please
>>> see attached file.
>>> I am using erlydtl for rendering.
>>>
>>> What could be the reason for this?
>>>
>>> Setup:
>>>
>>>    Mochiweb
>>> ---------------------------
>>>   Erlang/OTP 18
>>> ---------------------------
>>>  Ubuntu 14.04.3
>>> ---------------------------
>>>  VirtualBox 5.0.4
>>> --------------------------
>>>     Windows 7
>>> -------------------------
>>>
>>>
>>> File structure:
>>>
>>> :~/fe$ ls -l
>>> total 232
>>> -rwxr-xr-x 1 austin austin    310 Sep 25 18:25 bench.sh
>>> drwxrwxr-x 5 austin austin   4096 Sep 25 19:17 deps
>>> drwxrwxr-x 2 austin austin   4096 Sep 26 12:06 ebin
>>> -rw-rw-r-- 1 austin austin    418 Sep 25 18:25 Makefile
>>> drwxrwxr-x 3 austin austin   4096 Sep 25 18:25 priv
>>> -rwxrw-r-- 1 austin austin 199962 Sep 25 19:17 rebar
>>> -rw-rw-r-- 1 austin austin    313 Sep 25 19:13 rebar.config
>>> drwxrwxr-x 2 austin austin   4096 Sep 26 12:06 src
>>> -rwxr-xr-x 1 austin austin    119 Sep 25 18:25 start-dev.sh
>>> drwxrwxr-x 3 austin austin   4096 Sep 26 11:34 templates
>>> :~/fe$ ls -l templates/
>>> total 20
>>> drwxrwxr-x 2 austin austin  4096 Sep 26 11:33 data
>>> -rw-rw-r-- 1 austin austin 16339 Sep 26 11:34 login.dtl
>>> :~/fe$ ls -l templates/data/
>>> total 668
>>> -rwxrwxr-x 1 austin austin  57348 Sep 25 20:05 canvas-tools.js
>>> -rwxrwxr-x 1 austin austin 150767 Sep 25 20:05 d3.5.5_dynatrace.js
>>> -rwxrwxr-x 1 austin austin  46151 Sep 25 20:05
>>> d3.geo.projection.v0.2.12.min.js
>>> -rwxrwxr-x 1 austin austin   6916 Sep 25 20:05 d3map.js
>>> -rwxrwxr-x 1 austin austin   2679 Sep 25 20:05 d3.tip.v0.6.3.js
>>> -rw-rw-r-- 1 austin austin  43649 Sep 26 11:29 dynatraceLogo.jpg
>>> -rwxrwxr-x 1 austin austin   7365 Sep 25 20:05 exporting.js
>>> -rwxrwxr-x 1 austin austin   1229 Sep 25 20:05 exportingOffline.js
>>> -rwxrwxr-x 1 austin austin   3773 Sep 25 20:05 fonts.css
>>> -rwxrwxr-x 1 austin austin 153218 Sep 25 20:05 highcharts-4.0.3.js
>>> -rwxrwxr-x 1 austin austin  23135 Sep 25 20:05 highcharts-4.0.3-more.js
>>> -rwxrwxr-x 1 austin austin  84995 Sep 25 20:05 jquery-2.1.1.min.js
>>> -rwxrwxr-x 1 austin austin   2287 Sep 25 20:05 jquery.gridster.extras.js
>>> -rwxrwxr-x 1 austin austin  43758 Sep 25 20:05 jquery.gridster.js
>>> -rwxrwxr-x 1 austin austin  21325 Sep 25 20:05 login_logo.png
>>> -rwxrwxr-x 1 austin austin   6142 Sep 25 20:05 topojson.v1.6.18.min.js
>>> :~/fe$
>>>
>>> Thanks.
>>>
>>> Austin
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150927/5d606d57/attachment.html>


More information about the erlang-questions mailing list