On 4/9/06, Luis P. Mendes <[EMAIL PROTECTED]> wrote:
>
> I have the project in /home/luis/myproject.  Is it for a security reason
> that it should not be placed under htdocs? or other...

Yes, that is certainly part of it. Consider your settings.py file. It
has all your DB connection settings (username, password etc). That is
not something you want in a publicly accessible area of your server.
>
> 1- I run the django server and when I do http://localhost/application
> everything runs ok;
>
> 2- First thing I need to know is this: If it is a project with some
> applications, the project should have a home page.  From this home page,
> the user can choose from running applications.  In the tutorial I've
> read nothing about that project home page.  How can I do it? Create a
> view under /home/luis/myproject?  It didn't seem to work.

If you want to create any pages generated by django, then the url for
that page needs to be added to urls.py, which would then point to your
view. See the docs for info:
http://www.djangoproject.com/documentation/url_dispatch/  In case it
isn't clear, your url pattern would be defined something like this:

    urlpatterns = patterns('',
        ...
        (r'', 'path.to.your.view'),
    )

Which says that if your url is empty use the specified view. This
works great if the front page was to contain dynamic content - much
like the home page of djangoproject.com which pulls data from various
apps.

Alternatively, if you have static content which you would manually
edit occasionally, you could use flatpages for this. Simply put, if no
matches are found in urls.py, django checks for a flatpage with a
matching url and serves that if it is found. This actually sounds like
the best solution to your situation. For more on flatpages see:
http://www.djangoproject.com/documentation/flatpages/

>
> 3- Or it could be an index.html file placed under htdocs, served by
> apache with links to 'application'.  For me this solution would suit my
> needs at the moment, since the home page doesn't need any dynamic
> contents.  If so, how to configure both django and apache settings?  and
> how can I refer back to the index.html from inside any application?

I would NOT suggest this as the first solution, but here is one
untested answer (sort of). Assuming you set up mod-python according to
the instructions in the docs, look specifically at the section:
Serving Media Files
http://www.djangoproject.com/documentation/modpython/#serving-media-files

While your index.html is not exactly a media file, you still want to
serve it the same way as pre-existing image and css files. Note the
<Location> directives in the examples that 'SetHandler None'. This
basically turns off mod_python for those locations. In your case, you
want to turn off mod_python for the url "/", but not "/foo" or "/bar"
ect. I would assume this is possible with <LocationMatch>, but have
not tested it and am not going to suggest any possible solutions
because it just doesn't feel right, even if it does work. Flatpages
would be much better in this instance.



--
----
Waylan Limberg
[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to