Hi everyone,

I'm new to django so perhaps those are really simple questions so
sorry about that:

I had an php page already working (css formatted, imgs and
everything), it's a very simple page for uploading zip files to a
server. The server (system Apache 2.2.4 with django) has already the
main app powered with django, so Apache is configured to go through
django. I tried to do the fileupload through PHP, but couldn't figure
out how to make main django app and php fileupload page working
together. As soon as the \location tags of python,django were added to
httpd.conf, PHP page stopped working.

<Location "/">
   SetHandler python-program
   PythonPath "['D:\MainwebServer'] + sys.path"
   PythonHandler django.core.handlers.modpython
   SetEnv DJANGO_SETTINGS_MODULE server.settings
   PythonDebug On
</Location>
<Location "/media/">
   SetHandler None
</Location>
<LocationMatch "/.(jpg|gif|png)$">
   SetHandler None
</LocationMatch>


CARGAR MODULO PHP
#Loadfile "D:/PHP/php5ts.dll"
#PHPIniDir "D:/PHP/"
#AddHandler application/x-httpd-php .php
#AddHandler application/x-httpd-php-source .phps
#AddType application/x-httpd-php .html

So my first question goes here: Does anyone know how to share both PHP
and django pages in the same web project ?

Anyway, My 2nd move was to try to make the fileupload by using django
itself, so here I already have a rather simple upload page, it works
already but I want to add some more stuff:

1. As I had already the PHP page working I have all the design done
(css, img, etc) I don't know how to easily "move" the html design to
the django template (tried to point to MEDIA_ROOT but css doesn't
apply)

Here's my template

<head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Analyst DEMO server</title>
        <link href="style/style.css" rel="stylesheet" type="text/css" />
</head>

{% block body %}
<div class="container">
    <h1>Subir fichero ZIP a servidor DEMO</h1>
    <div class="body">
      <p>
        <form action="." method="post"
              enctype="multipart/form-data">
          <table>
            {{ form }}
          </table>
          <input type="submit" value="Subir ZIP" />
        </form>
      </p><br />
      <p>Resultados de subida.</p>
    </div>
  </div>
{% endblock %}

and here's the old php page, it uses javascript to show/hide some
labels once the fileupload was performed and if it was success or not:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /
>
   <title>Main DEMO server</title>
   <link href="style/style.css" rel="stylesheet" type="text/css" />

<script language="javascript" type="text/javascript">
<!--
function startUpload(){
      document.getElementById('upload_process').style.visibility =
'visible';
      document.getElementById('upload_form').style.visibility =
'hidden';
      return true;
}

function stopUpload(success){
      var result = '';
      if (success == 1){
         result = '<span class="msg">Fichero correctamente subido!<\/
span><br/><br/>';
      }
      else {
         result = '<span class="emsg">Error al subir el fichero!<\/
span><br/><br/>';
      }
      document.getElementById('upload_process').style.visibility =
'hidden';
      document.getElementById('upload_form').innerHTML = result +
'<label>File: <input name="myfile" type="file" size="30" /><\/
label><label><input type="submit" name="submitBtn" class="sbtn"
value="Enviar" /><\/label>';
      document.getElementById('upload_form').style.visibility =
'visible';
      return true;
}
//-->
</script>
</head>

<body>
       <div id="container">
            <div id="header"><div id="header_left"></div>
            <div id="header_main">Main DEMO server</div><div
id="header_right"></div></div>
            <div id="content">
                <form action="upload.php" method="post"
enctype="multipart/form-data" target="upload_target"
onsubmit="startUpload();" >
                     <p id="upload_process">Subiendo fichero...<br/
><img src="loader.gif" /><br/></p>
                     <p id="upload_form" align="center"><br/>
                         <label>Fichero (zip):
                              <input name="myfile" type="file"
size="30" />
                         </label>
                         <label>
                             <input type="submit" name="submitBtn"
class="sbtn" value="Enviar" />
                         </label>
                     </p>

                     <iframe id="upload_target" name="upload_target"
src="#" style="width:0;height:0;border:0px solid #fff;"></iframe>
                 </form>
</body>

So:

2. Is there any built-in opton in Django (0.97 version) to unzip
files. I would need to unzip the file to a folder once the upload has
been done.

Thanks a lot in advance for the help

Vince


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to