Deployment in /~user/codespeed/ instead of speed.example.org?

34 views
Skip to first unread message

Stefan Marr

unread,
Jul 11, 2011, 7:40:01 AM7/11/11
to codespeed
Hi,

I was fighting with settings.py and url.py to be able to deploy code
speed in a subfolder instead of a subdomain.

Didn't really find good hints about django and something like a
BASE_URL constant. Looked like I would need to modify the templates.

Any hints how to do that without changing to much are very welcome.

Thanks
Stefan

Stefan Marr

unread,
Jul 11, 2011, 1:24:54 PM7/11/11
to codespeed
Hi:
Guess, I could be more specific. I think, the main problem are the
static resources.
Either I change the setting to include the full base URL, which
results in correct URLs in the HTML sent to the browser, but fails
then processing the requests since the requested URLs seem to be
associated with the correct handler.
If I give the prefix to the corresponding function in the url.py then
the handlers are setup correctly but the generated HTML is wrong.

Thought I experimented with all permutations, but am just wondering
whether I tried the combination.
Hm, well, will try it later.
Any other django specific hints are still welcome.

Thanks
Stefan

Stefan Marr

unread,
Jul 11, 2011, 7:48:19 PM7/11/11
to codespeed
Hi:

On Jul 11, 7:24 pm, Stefan Marr <goo...@stefan-marr.de> wrote:
> > I was fighting with settings.py and url.py to be able to deploy code
> > speed in a subfolder instead of a subdomain.
>
> Guess, I could be more specific. I think, the main problem are the
> static resources.
> Either I change the setting to include the full base URL, which
> results in correct URLs in the HTML sent to the browser, but fails
> then processing the requests since the requested URLs seem to be
> associated with the correct handler.
> If I give the prefix to the corresponding function in the url.py then
> the handlers are setup correctly but the generated HTML is wrong.

Ok, I found a solution.
In settings.py I set: STATIC_URL = '/~user/codespeed/static/'
and in the apache config, I add an Alias /~user/codespeed/static/ /
home/user/public_html/codespeed/speedcenter/sitestatic/.

This does the trick, there is only one detail not working: the image
which shows that data is loaded via AJAX is broken, since codespeed.js
is served as static and the embedded URL is not adapted automatically.

Best regards
Stefan

Frank Becker

unread,
Jul 12, 2011, 8:57:26 AM7/12/11
to code...@googlegroups.com
Stefan Marr [2011-07-12, 01:48 +0200]:

Hi,

> On Jul 11, 7:24 pm, Stefan Marr <goo...@stefan-marr.de> wrote:
> > > I was fighting with settings.py and url.py to be able to deploy code
> > > speed in a subfolder instead of a subdomain.
> >
> > Guess, I could be more specific. I think, the main problem are the
> > static resources.
>

> Ok, I found a solution.
> In settings.py I set: STATIC_URL = '/~user/codespeed/static/'

Right, that tells how to replace STATIC_URL in the templates.

Further url.py in the Django project folder let's you change the URL e. g.
to /~user/foo/bar/codespeed/
That's a benefit of the Django app separation.

> This does the trick, there is only one detail not working: the image
> which shows that data is loaded via AJAX is broken, since codespeed.js is
> served as static and the embedded URL is not adapted automatically.

Good point. For css you can do relative links such as
url(../images/pix.png) since the link is in respect to the file location of
the css, IIRC. For JS that is more tricky. I just sent a pull request where
I set a global JS variable and that is used in codespeed.js
https://github.com/a8/codespeed-a8/commit/a769e973fe828729de9c5bc63a7afb9311159b7b

Bye,

Frank

--
Frank Becker <f...@alien8.de> (jabber|mail) | http://twitter.com/41i3n8
GnuPG: 0xADC29ECD | F01B 5E9C 1D09 981B 5B40 50D3 C80F 7459 ADC2 9ECD
SILC-Net: a8 | Home: http://www.alien8.de | <<</>> http://www.c3d2.de
"> Freedom is just chaos, with better lighting. <" Alan Dean Foster

signature.asc

Miquel Torres

unread,
Jul 14, 2011, 3:09:21 AM7/14/11
to code...@googlegroups.com
Was fixed by Frank in issue #62

Cheers!
Miquel


2011/7/12 Frank Becker <f...@alien8.de>:

Reply all
Reply to author
Forward
0 new messages