×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Sep 2006
    Location
    Beijing, China
    Posts
    386

    need help with really basic web site

    Hi,

    I wonder if someone can help me move a really basic web site onto my phone.

    The web site is basically a python cgi script that redirects the browser based on the query string and user agent.

    The site URL has to be
    Code:
    http://blabla/record.cgi
    because it's already hard-coded in an application.

    I've tried to look into the documents, but they seem to all be assuming some overall web site structure. I want to basically get rid of all that and just mirror what I have on our regular server.

    Of course, I expect some changes - in fact I already converted record.cgi from perl into python, but it seems I need to do more work to make it mod_perl.

    The script is pretty simple. It just extracts some stuff from the query string and user agent and redirects to a local html file. It also does outputs some stuff to a local text file.

    Can someone with experience in MWS give me some pointers how to start?

    Thanks,

    Max.

    PS. It seems my python script has several 'import' lines - urllib, cgi, cgitb, os and time - if that makes any difference.
    Last edited by davidmaxwaterman; 2009-05-09 at 14:58. Reason: more info

  2. #2
    Registered User
    Join Date
    Nov 2008
    Posts
    24

    Re: need help with really basic web site

    You will be able to find some basic examples on how to create your first web pages for Mobile Web Servers in Python language.

    For example: "Mobile Web Server: How to Develop Content"

    Check this link, as I think you will find some interesting PDF files to start with:
    http://www.forum.nokia.com/Resources...Documentation/

    Have luck!

  3. #3
    Registered User
    Join Date
    Sep 2006
    Location
    Beijing, China
    Posts
    386

    Re: need help with really basic web site

    Quote Originally Posted by didacgil9 View Post
    You will be able to find some basic examples on how to create your first web pages for Mobile Web Servers in Python language.

    For example: "Mobile Web Server: How to Develop Content"

    Check this link, as I think you will find some interesting PDF files to start with:
    http://www.forum.nokia.com/Resources...Documentation/

    Have luck!
    Yes, I already looked there and read many things - some is helpful, and some not. Most assumes you want to develop pages that fit into their web page system, rather than just replace the whole lot. I would use their 'system', but it seems to mean that my web site will be on a subdirectory, eg
    Code:
    http://blabla/SUBDIR/record.cgi
    , when the URL I have to have is
    Code:
    http://blabla/record.cgi
    .

    Is there anyone here who can help me by telling me if I can replace their 'system' with my own code and the steps that might be involved?

    Max.

  4. #4
    Registered User
    Join Date
    Nov 2008
    Posts
    24

    Smile Re: need help with really basic web site

    Quote Originally Posted by davidmaxwaterman View Post
    Yes, I already looked there and read many things - some is helpful, and some not. Most assumes you want to develop pages that fit into their web page system, rather than just replace the whole lot. I would use their 'system', but it seems to mean that my web site will be on a subdirectory, eg
    Code:
    http://blabla/SUBDIR/record.cgi
    , when the URL I have to have is
    Code:
    http://blabla/record.cgi
    .

    Is there anyone here who can help me by telling me if I can replace their 'system' with my own code and the steps that might be involved?

    Max.
    Check for exmple this other link, to a PDF book.

    http://mymobilesite.net/files/Mobile...er_Book_en.pdf

    From page 70 on, you will see is possible to create MWS Framework independent pages in Python. For example, a page getting text from a formulary and playing it through the audio.say() feature.

    Once you get your web page the structure, check for more functions and resources you can access from Python in this link:
    http://www.forum.nokia.com/Resources...ython_for_S60/

    I can promise you. It's possible to create your own pages in Python in the MWS without using the original Framework.

  5. #5
    Registered User
    Join Date
    Sep 2006
    Location
    Beijing, China
    Posts
    386

    Re: need help with really basic web site

    Quote Originally Posted by didacgil9 View Post
    I can promise you. It's possible to create your own pages in Python in the MWS without using the original Framework.
    OK, I've played with it some...like trying to find my way in the dark, somewhat, but I've gotten somewhere.

    It seems I need urllib :

    Code:
    ImportError: cannot import name urllib
    Any ideas how I can get urllib installed?

    Actually, it's the first of a series of things I need :

    Code:
        from mod_python import urllib
        from mod_python import cgi
        from mod_python import cgitb; cgitb.enable()  # for troubleshooting
        from mod_python import os
        from mod_python import time
    Is that 'from mod_python' bit right - I added it based on the example, but in my original script (which is plain python, not mod_python), I just 'import whatever'.

    Any ideas? It seems much closer now

    Max.

  6. #6
    Registered User
    Join Date
    Feb 2008
    Posts
    21

    Re: need help with really basic web site

    Quote Originally Posted by davidmaxwaterman View Post
    Is that 'from mod_python' bit right - I added it based on the example, but in my original script (which is plain python, not mod_python), I just 'import whatever'.
    these modules you want to import are not from mod_python...so you don´t need "from mod_python import xyz"

    just import like in your original script, like:
    import urllib
    import time
    import os
    ...

    hope it helps,
    Askin

  7. #7
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    457

    Re: need help with really basic web site

    Note also that - unfortunately - the PyS60 used by MWS is not the new 1.9 series, but the old 1.4. So, some modules that usually are available in a Python installation are missing.

    Br,
    Johan

  8. #8
    Registered User
    Join Date
    Sep 2006
    Location
    Beijing, China
    Posts
    386

    Re: need help with really basic web site

    Quote Originally Posted by jhnwkmn View Post
    Note also that - unfortunately - the PyS60 used by MWS is not the new 1.9 series, but the old 1.4. So, some modules that usually are available in a Python installation are missing.

    Br,
    Johan
    Yes, I guess this is why I figured it should be 'from mod_python' - it wasn't working when I do it in the regular way.

    What's the alternative to cgi, os, and time?

    ...also, I'm finding it a little bit frustrating copying files to the phone just to try a little edit. Is there any way I can set up the server on my linux box so that it's identicle to the one on the phone, then i can more easily test? ...or is there some other way?

    Max.
    Last edited by davidmaxwaterman; 2009-05-11 at 21:21. Reason: added question about development environment

  9. #9
    Registered User
    Join Date
    Dec 2003
    Posts
    20

    Re: need help with really basic web site

    You can develop your scripts and pages in your PC with the S60 SDK plug-in, but unfortunately it doesn't work in Linux environment as far as I know. Install S60 SDK first and then the plug-in after that.

  10. #10
    Registered User
    Join Date
    Sep 2006
    Location
    Beijing, China
    Posts
    386

    Re: need help with really basic web site

    Quote Originally Posted by jpusa View Post
    You can develop your scripts and pages in your PC with the S60 SDK plug-in, but unfortunately it doesn't work in Linux environment as far as I know. Install S60 SDK first and then the plug-in after that.
    That seems like a very obfuscated method of simulating the environment. There's no way I'm going to buy any OS for this purpose, let alone a Microsoft one.

    Has no one managed to configure a regular web installation for this? It seems like the most obvious way.

    If not, I guess I'll have to have a go at figuring it out myself. If I manage to get it working, I'll be sure to post back a 'how-to' or something.

    Max.

  11. #11
    Registered User
    Join Date
    Nov 2008
    Posts
    24

    Re: need help with really basic web site

    Quote Originally Posted by jhnwkmn View Post
    Note also that - unfortunately - the PyS60 used by MWS is not the new 1.9 series, but the old 1.4. So, some modules that usually are available in a Python installation are missing.

    Br,
    Johan
    I have PAMP, MWS and PyS60 1.9.4 installed.
    In this case, as I installed PyS60 1.9.4 after installing MWS, which PyS60 version does MWS uses?

    I need to say that both Python (my own scripts) and MWS (the original framework) are working fine. The only problem, it does not allow me to check the contact list in the administrator section of the MWS framework.

  12. #12
    Registered User
    Join Date
    Sep 2006
    Location
    Beijing, China
    Posts
    386

    Re: need help with really basic web site

    Quote Originally Posted by jpusa View Post
    but unfortunately it doesn't work in Linux environment as far as I know.
    Well, I was able to basically get apache working on my linux box and just use that for the majority of the development...it was trivial to set up.

    Anyway, I have a couple of remaining problems, that I hope someone can help me with.

    My perl scripts were named '.cgi' and there were multiple scripts in the same directory. I've ported them to '.py' scripts. So, I need to make the pythod work from files named '.cgi'.

    Furthermore, my scripts are all in the same directory, so I need to make it so that multiple scripts can work in the same directory.

    Any ideas welcome!

    Thanks,

    Max.

  13. #13
    Registered User
    Join Date
    Sep 2006
    Location
    Beijing, China
    Posts
    386

    Re: need help with really basic web site

    Quote Originally Posted by davidmaxwaterman View Post
    Anyway, I have a couple of remaining problems, that I hope someone can help me with.

    My perl scripts were named '.cgi' and there were multiple scripts in the same directory. I've ported them to '.py' scripts. So, I need to make the pythod work from files named '.cgi'.

    Furthermore, my scripts are all in the same directory, so I need to make it so that multiple scripts can work in the same directory.
    And another problem :

    The web site is normally accessed using http://my.real.domain/record.cgi., but on the phone, it is http://myphone.mymobilesite.net/record.cgi. It seems like *.mymobilesite.net resolve to the same address, so I can't use DNS to resolve my.real.domain to myphone.mymobilesite.net. I have to use some other method.

    Any ideas welcome!
    Max.

Similar Threads

  1. How can I post continuous camera images on the web site?
    By premlathiya in forum Mobile Java General
    Replies: 1
    Last Post: 2006-09-06, 23:40
  2. about Web site
    By tyhok in forum Browsing and Mark-ups
    Replies: 1
    Last Post: 2003-06-27, 07:31

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •