0

I am trying to setup an APE server for my Django project.

Setup

  1. I followed the setup instructions in the APE wiki: Simple APE Configuration

    I had to change the port though. My virtual host config reads as follows:

    NameVirtualHost 127.0.0.1:8100
    Listen 127.0.0.1:8100
    <VirtualHost 127.0.0.1:8100>
        ServerName local.ape-project.org
        ServerAlias ape.local.ape-project.org
        ServerAlias *.ape.local.ape-project.org
    
        DocumentRoot "/path/to/my/project/ape-jsf/"
    </VirtualHost>
    

    Running http://local.ape-project.org:8100/Tools/Check/ runs all tests successfully and returns the message: All test done. Now you can play with your APE \o/

  2. Django is running on port 8000:

    python manage.py runserver_plus 0.0.0.0:8000

  3. I followed the instructions for the first tutorial: Tutorial: Color Changer

    I put the JavaScript code into my django project (with inclusion of Clients/JavaScript.js).

Problem

When i open the page, i get this error:

Unsafe JavaScript attempt to access frame with URL http://2.ape.local.ape-project.org:6969/?[{%22cmd%22:%22script%22,%22params%22:{%22domain%22:%22127.0.0.1%22,%22scripts%22:[%22http://local.ape-project.org:8100/static/ape-jsf/Source/mootools-core.js%22,%22http://local.ape-project.org:8100/static/ape-jsf/Source/Core/APE.js%22,%22http://local.ape-project.org:8100/static/ape-jsf/Source/Core/Events.js%22,%22http://local.ape-project.org:8100/static/ape-jsf/Source/Core/Core.js%22,%22http://local.ape-project.org:8100/static/ape-jsf/Source/Pipe/Pipe.js%22,%22http://local.ape-project.org:8100/static/ape-jsf/Source/Pipe/PipeProxy.js%22,%22http://local.ape-project.org:8100/static/ape-jsf/Source/Pipe/PipeMulti.js%22,%22http://local.ape-project.org:8100/static/ape-jsf/Source/Pipe/PipeSingle.js%22,%22http://local.ape-project.org:8100/static/ape-jsf/Source/Request/Request.js%22,%22http://local.ape-project.org:8100/static/ape-jsf/Source/Request/Request.Stack.js%22,%22http://local.ape-project.org:8100/static/ape-jsf/Source/Request/Request.CycledStack.js%22,%22http://local.ape-project.org:8100/static/ape-jsf/Source/Transport/Transport.longPolling.js%22,%22http://local.ape-project.org:8100/static/ape-jsf/Source/Transport/Transport.SSE.js%22,%22http://local.ape-project.org:8100/static/ape-jsf/Source/Transport/Transport.XHRStreaming.js%22,%22http://local.ape-project.org:8100/static/ape-jsf/Source/Transport/Transport.JSONP.js%22,%22http://local.ape-project.org:8100/static/ape-jsf/Source/Core/Utility.js%22,%22http://local.ape-project.org:8100/static/ape-jsf/Source/Core/JSON.js%22]}}]
from frame with URL http://127.0.0.1:8000/mydjangoapp/somepage/. Domains, protocols and ports must match.

I understand that there is a security issue with different domains and ports.

But how is this supposed to work?

Alp
  • 29,274
  • 27
  • 120
  • 198

1 Answers1

2

It turned out that it's difficult to configure an environment that runs both Ape and runserver. The solution to this problem is to use another web server.

I chose Apache and the mod_wsgi module:

Alp
  • 29,274
  • 27
  • 120
  • 198
  • I'm running into the same problem. I have dev.mydomain.com and ape.mydomain.com. Is this how you are setup, or are you running everything from the same domain? Thanks. – stampede76 Nov 09 '12 at 05:51
  • I found an answer from their google groups. By adding {transport:2} as a parameter to client.load() like client.load({transport: 2}); it works with different subdomains https://groups.google.com/forum/?fromgroups=#!searchin/ape-project/Domains,$20protocols$20and$20ports$20must$20match./ape-project/hOwoKSDLsug/NUXkM7MTgPEJ – stampede76 Nov 09 '12 at 06:02
  • 1
    By the way, i dumped APE because there are better alternatives. Currently, i am very happy with sockjs. See this excellent answer to my question: http://stackoverflow.com/a/10950702/675065 – Alp Nov 09 '12 at 13:05
  • I will check it out and see how it goes. I do not need the same volume of messages, but possibly many connections. I need something to avoid interval polling for 1 or 2 messages every 10 minutes for many users. I'll run some tests on APE and if that does not work switch to sockjs. Thanks. – stampede76 Nov 09 '12 at 20:01