OK the view.py functions are the way Django responds to a browser request.
IOW the browser asks for a page to display and Django checks the URL (in the urls.py). In the urls.py you have to have an entry something like url(r'signup/$', 'signup.views.home', name ='signup') and then Django excutes the function (in this case signup.views.home).

Where signup is a Django app created when you used 'startapp'. In the signup directory (assuming that's where you placing everything - doesn't have to be) there should be a views.py. In views.py there should be a function 'home' and in there you should render the response - just like you did for the other home.

Beyond that - please read and follow the Django tutorial - pay close attention to the way the layout of the code is done.

Johnf

On 03/12/2015 12:03 PM, sourav mohanty wrote:
from 'My templates just wouldn't load or show' , i mean that my base.html loads perfectly but signup.html doesn't show up.

On Friday, March 13, 2015 at 12:20:26 AM UTC+5:30, sourav mohanty wrote:

    i have revised the views.py :

    fromdjango.shortcutsimportrender,render_to_response,RequestContext

    # from .forms import SignUpForm
    # Create your views here.
    fromdjango.templateimportContext,Template


    defhome(request):
         # form = SignUpForm(request.POST or None)

         # if form.is_valid():
         #     save_it = form.save(commit=False)
         #     save_it.save()

         returnrender_to_response("base.html",
                                   locals(),
                                   context_instance=RequestContext(request))


    defhomeonce(request):
         context = {}
         template ="base.html"
         returnrender(request,template,context)



    Render reference is

    <divclass="container">
           {%blocksign%}
          {%endblock%}
    <hr>


    base.html :

    <!DOCTYPEhtml>
    <htmllang="en">
       <head>
         <metacharset="utf-8">
         <metahttp-equiv="X-UA-Compatible"content="IE=edge">
         <metaname="viewport"content="width=device-width, initial-scale=1">
         <metaname="description"content="">
         <metaname="author"content="">
         <linkrel="icon"href="../../favicon.ico">

         <title>Homepage</title>

         <!-- Latest compiled and minified CSS -->
         
<linkrel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css
  <https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css>">

         <!-- Optional theme -->
         
<linkrel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css
  <https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css>">

         <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and 
media queries -->
         <!--[if lt IE 9]>
           <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js  
<https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js>"></script>
           <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js  
<https://oss.maxcdn.com/respond/1.4.2/respond.min.js>"></script>
         <![endif]-->
       </head>

       <body>


    <!-- Main jumbotron for a primary marketing message or call to action
         <div class="jumbotron">
           <div class="container">
             <div class="col-lg-6">
             <h1>Hello, world!</h1>
             <p>This is a template for a simple marketing or informational website. 
It includes a large callout called a jumbotron and three supporting pieces of content. Use 
it as a starting point to create something more unique.</p>
             <p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more 
&raquo;</a></p>
             </div>
           </div>
         </div>
    -->
    <divclass="container">
           {%blocksign%}
          {%endblock%}
    <hr>

         <divclass="container">
           <hr>

             <footer>
             <p>&copy;Company 2014</p>
             </footer>
         </div><!-- /container -->


         <!-- Bootstrap core JavaScript
         ================================================== -->
         <!-- Placed at the end of the document so the pages load faster -->
         <scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js  
<https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js>"></script>
         <!-- Latest compiled and minified JavaScript -->
         <scriptsrc="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js  
<https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js>"></script>
</body>
    </html>


    signup.html:

    {%extends"base.html"%}

    {%blocksign%}
        <formclass="form-horizontal 
col-lg-4"method='POST'action=''>{%csrf_token%}
        <legend>Sign Up</legend>
        <!--{{form.as_p}}-->
           <divclass="col-lg-10 col-lg-offset-2">
             <buttontype="submit"class="btn btn-primary">Submit</button>
           </div>
         </div>
        </fieldset>
        </form>

    {%endblock%}


    Please help.. its really out of my hands.. Thank you for your reply..

    On Thursday, March 12, 2015 at 9:51:57 PM UTC+5:30, James
    Schneider wrote:

        You also have two different URL's named 'home', which will
        lead to a bad time. Make sure that those are unique.

        From what I can tell, none of your views render/reference
        'signup.html', so I would never expect that template to be
        rendered.

        Configure a fields attribute on your form to get rid of the
        deprecation warning. This will be required moving forward
        through future version of Django:

        
https://docs.djangoproject.com/en/1.7/topics/forms/modelforms/#selecting-the-fields-to-use
        
<https://docs.djangoproject.com/en/1.7/topics/forms/modelforms/#selecting-the-fields-to-use>

        When you say 'My templates just wouldn't load or show', what
        exactly is shown in the browser window and/or runserver console?

        My suggestion would be to install the django-debug-toolbar, as
        you can use it to investigate the templates being used by your
        view and where Django is looking to find those templates.

        -James


        On Thu, Mar 12, 2015 at 6:19 AM, john <jo...@jfcomputer.com>
        wrote:

            You have two 'home' functions in views.py.
            You have an indent on the first line of the urls.py (could
            be the paste)
            You did not provide the forms.py

            Johnf

            On 03/12/2015 01:31 AM, sourav mohanty wrote:

                I dont know why but i'm facing a strange problem.. My
                templates just wouldn't load or show. can you please
                help me out. I'm using Django version 1.7

                It shows the following warning as well in the cmd :
                C:\Users\Om
                Computers\PyDisco\venv\ddisco\signups\forms.py:5:
                RemovedInDjango18W arning: Creating a ModelForm
                without either the 'fields' attribute or the 'exclu
                de' attribute is deprecated - form SignUpForm needs
                updating class SignUpForm(forms.ModelForm):

                I have an application called ddisco and an app within
                it called signups and my templates are stored within
                the templates folder.

                settings.py

                |    """
                Django settings for ddisco project.

                For more information on this file, see
                https://docs.djangoproject.com/en/1.7/topics/settings/  
<https://docs.djangoproject.com/en/1.7/topics/settings/>

                For the full list of settings and their values, see
                https://docs.djangoproject.com/en/1.7/ref/settings/  
<https://docs.djangoproject.com/en/1.7/ref/settings/>
                """

                # Build paths inside the project like this: 
os.path.join(BASE_DIR, ...)
                import  os
                BASE_DIR=  os.path.dirname(os.path.dirname(__file__))


                # Quick-start development settings - unsuitable for production
                # 
Seehttps://docs.djangoproject.com/en/1.7/howto/deployment/checklist/  
<https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/>

                # SECURITY WARNING: keep the secret key used in production 
secret!
                SECRET_KEY=  ''

                # SECURITY WARNING: don't run with debug turned on in 
production!
                DEBUG=  True

                TEMPLATE_DEBUG=  True

                ALLOWED_HOSTS=  []


                # Application definition

                INSTALLED_APPS=  (
                     'django.contrib.admin',
                     'django.contrib.auth',
                     'django.contrib.contenttypes',
                     'django.contrib.sessions',
                     'django.contrib.messages',
                     'django.contrib.staticfiles',
                     'signups',
                )

                MIDDLEWARE_CLASSES=  (
                     'django.contrib.sessions.middleware.SessionMiddleware',
                     'django.middleware.common.CommonMiddleware',
                     'django.middleware.csrf.CsrfViewMiddleware',
                     'django.contrib.auth.middleware.AuthenticationMiddleware',
                     
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
                     'django.contrib.messages.middleware.MessageMiddleware',
                     'django.middleware.clickjacking.XFrameOptionsMiddleware',
                )

                ROOT_URLCONF=  'ddisco.urls'

                WSGI_APPLICATION=  'ddisco.wsgi.application'


                # Database
                #https://docs.djangoproject.com/en/1.7/ref/settings/#databases  
<https://docs.djangoproject.com/en/1.7/ref/settings/#databases>

                DATABASES=  {
                     'default':  {
                         'ENGINE':  'django.db.backends.sqlite3',
                         'NAME':  os.path.join(BASE_DIR,  'db.sqlite3'),
                     }
                }

                # Internationalization
                #https://docs.djangoproject.com/en/1.7/topics/i18n/  
<https://docs.djangoproject.com/en/1.7/topics/i18n/>

                LANGUAGE_CODE=  'en-us'

                TIME_ZONE=  'UTC'

                USE_I18N=  True

                USE_L10N=  True

                USE_TZ=  True


                # Static files (CSS, JavaScript, Images)
                #https://docs.djangoproject.com/en/1.7/howto/static-files/  
<https://docs.djangoproject.com/en/1.7/howto/static-files/>

                STATIC_URL=  '/static/'

                # Template location
                TEMPLATE_DIRS=  (
                     os.path.join(BASE_DIR,  'templates'),
                )

                if  DEBUG:
                     MEDIA_URL=  '/media/'
                     STATIC_ROOT=  os.path.join(BASE_DIR,  'staticonly')
                     MEDIA_ROOT=  os.path.join(BASE_DIR,  'media')
                     STATICFILES_DIRS=  (
                         os.path.join(BASE_DIR,  'static'),
                     )|

                urls.py

                |     from  django.conf.urlsimport  patterns,  include,  url

                from  django.confimport  settings
                from  django.conf.urls.staticimport  static


                from  django.contribimport  admin
                admin.autodiscover()

                urlpatterns=  patterns('',
                     # Examples:
                     url(r'^$',  'signups.views.home',  name='home'),
                     url(r'^s/$',  'signups.views.home',  name='home'),
                     # url(r'^blog/', include('blog.urls')),

                     url(r'^admin/',  include(admin.site.urls)),
                )

                if  settings.DEBUG:
                     urlpatterns+=  
static(settings.STATIC_URL,document_root=settings.STATIC_ROOT)
                     urlpatterns+=  
static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT)|

                models.py

                |
                fromdjango.db importmodels fromdjango.utils.encoding
                importsmart_unicode # Create your models
                here.classSignUp(models.Model):first_name =models.|

    ...

--
You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com <mailto:django-users+unsubscr...@googlegroups.com>. To post to this group, send email to django-users@googlegroups.com <mailto:django-users@googlegroups.com>.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d338068d-24ca-4693-8b41-cdcc6d6302d0%40googlegroups.com <https://groups.google.com/d/msgid/django-users/d338068d-24ca-4693-8b41-cdcc6d6302d0%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5501EF9C.4000104%40jfcomputer.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to