Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Jan. 3, 2011 13:53:25

Anthony P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Templates Directory Question


In Tutorial 2, I was instructed to make a templates directory. It is
located at:
C:\DjangoProjects\mysite\templates

Now again in Tutorial 3, section "Write views that actually do
something", I am given the instructions:
.... create a directory, somewhere on your filesystem, whose
contents Django can access. (Django runs as whatever user your server
runs.) Don't put them under your document root.....


I think the document who's root I cannot put them under is the
views.py document, as that's what I had been editing. It is located
at:
C:\DjangoProjects\mysite\polls\views.py

I guess my question is, where is the best place for this new templates
directory? Can I simply make a subdirectory in the templates
directory for the views.py template? For example, like this:
C:\DjangoProjects\mysite\templates\views\

Sorry for a question with likely a quite obvious solution, but thanks
again for any assistance.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Jan. 3, 2011 13:56:57

Mo J.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Templates Directory Question


By document root they mean apache public directory, aka htdocs

Sent from my iPhone

On Jan 3, 2011, at 4:53 PM, Anthony Pearce <coden...@gmail.com> wrote:

> In Tutorial 2, I was instructed to make a templates directory. It is
> located at:
> C:\DjangoProjects\mysite\templates
>
> Now again in Tutorial 3, section "Write views that actually do
> something", I am given the instructions:
> .... create a directory, somewhere on your filesystem, whose
> contents Django can access. (Django runs as whatever user your server
> runs.) Don't put them under your document root.....
>
>
> I think the document who's root I cannot put them under is the
> views.py document, as that's what I had been editing. It is located
> at:
> C:\DjangoProjects\mysite\polls\views.py
>
> I guess my question is, where is the best place for this new templates
> directory? Can I simply make a subdirectory in the templates
> directory for the views.py template? For example, like this:
> C:\DjangoProjects\mysite\templates\views\
>
> Sorry for a question with likely a quite obvious solution, but thanks
> again for any assistance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Jan. 3, 2011 14:26:55

Anthony P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Templates Directory Question


Now I feel stupid. That intelligent comment flew right over my head.
I'm not sure yet where apache is falling in here yet, nor do I know
what htdocs is.

I should mention I'm using Windows 7 also, in case any terminology is
based on another OS.


On Jan 3, 10:56 pm, "Mo J. Al-Mughrabi" <mo.mughr...@gmail.com> wrote:
> By document root they mean apache public directory, aka htdocs
>
> Sent from my iPhone
>
> On Jan 3, 2011, at 4:53 PM, Anthony Pearce <coden...@gmail.com> wrote:
>
>
>
> > In Tutorial 2, I was instructed to make a templates directory. It is
> > located at:
> >     C:\DjangoProjects\mysite\templates
>
> > Now again in Tutorial 3, section "Write views that actually do
> > something", I am given the instructions:
> >     .... create a directory, somewhere on your filesystem, whose
> > contents Django can access. (Django runs as whatever user your server
> > runs.) Don't put them under your document root.....
>
> > I think the document who's root I cannot put them under is the
> > views.py document, as that's what I had been editing.  It is located
> > at:
> >     C:\DjangoProjects\mysite\polls\views.py
>
> > I guess my question is, where is the best place for this new templates
> > directory?  Can I simply make a subdirectory in the templates
> > directory for the views.py template?  For example, like this:
> >     C:\DjangoProjects\mysite\templates\views\
>
> > Sorry for a question with likely a quite obvious solution, but thanks
> > again for any assistance.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group
> > athttp://groups.google.com/group/django-users?hl=en.-Hide quoted text -
>
> - Show quoted text -

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 Jan. 3, 2011 15:52:39

Daniel H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Templates Directory Question


You can put the templates anywhere you want, by a good place is a
directory named templates in the base directory of your project, i.e.

C:\DjangoProjects\mysite\templates\

Don't forget to add this path to the TEMPLATE_DIRS variable in your settings.py.

The template file from the example would be placed at

C:\DjangoProjects\mysite\templates\polls\index.html

You can probably ignore the document root for now, but I'll try to
explain what it means.
The term "document root" refers to the directory that a webserver like
Apache uses to look for files.
Let's say the webserver running on example.com is configured with
document_root = C:\apache\htdocs. If you visithttp://example.com/foo.html, the webserver would serve you the file
C:\apache\htdocs\foo.html.
I hope that makes sense and doesn't add to the confusion.

Daniel

On Mon, Jan 3, 2011 at 3:26 PM, Anthony Pearce <coden...@gmail.com> wrote:
> Now I feel stupid. That intelligent comment flew right over my head.
> I'm not sure yet where apache is falling in here yet, nor do I know
> what htdocs is.
>
> I should mention I'm using Windows 7 also, in case any terminology is
> based on another OS.
>
>
> On Jan 3, 10:56 pm, "Mo J. Al-Mughrabi" <mo.mughr...@gmail.com> wrote:
>> By document root they mean apache public directory, aka htdocs
>>
>> Sent from my iPhone
>>
>> On Jan 3, 2011, at 4:53 PM, Anthony Pearce <coden...@gmail.com> wrote:
>>
>>
>>
>> > In Tutorial 2, I was instructed to make a templates directory. It is
>> > located at:
>> >     C:\DjangoProjects\mysite\templates
>>
>> > Now again in Tutorial 3, section "Write views that actually do
>> > something", I am given the instructions:
>> >     .... create a directory, somewhere on your filesystem, whose
>> > contents Django can access. (Django runs as whatever user your server
>> > runs.) Don't put them under your document root.....
>>
>> > I think the document who's root I cannot put them under is the
>> > views.py document, as that's what I had been editing.  It is located
>> > at:
>> >     C:\DjangoProjects\mysite\polls\views.py
>>
>> > I guess my question is, where is the best place for this new templates
>> > directory?  Can I simply make a subdirectory in the templates
>> > directory for the views.py template?  For example, like this:
>> >     C:\DjangoProjects\mysite\templates\views\
>>
>> > Sorry for a question with likely a quite obvious solution, but thanks
>> > again for any assistance.
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups
>> > "Django users" group.
>> > To post to this group, send email to django-us...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group
>> > athttp://groups.google.com/group/django-users?hl=en.-Hide quoted text -
>>
>> - Show quoted text -
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 23rd of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support