You are not logged in.

Change Language:

Profile for octopusgrabbus

Name octopusgrabbus
Email Address old_road_farm@verizon.net
Website URLhttp://octopusgrabbus.wordpress.com
AvatarUsers avatar
Posts11
  • Re: How to correct missing template error
    Board » Django » Views
    Thank you a second time. This answer helped me when staging out a new project.

    you need a template file called 'login.html' in the directory 'registration' (ie. registration/login.html) under one of the paths listed in your settings.py under TEMPLATE_DIRS .. is this the case for you?

  • Re: Deploying On Apache
    Board » Getting Started » Setup and Configuration
    I've got Apache configuration that allows me to run -- I'll try to remember to post next week -- but does not allow me to load the graphics for the admin part or my own custom css pages.
  • Re: No module named admin.site.urls
    Board » Getting Started » Setup and Configuration
    In your URLs did you also uncomment the line to import the admin and discover it?
    Sorry if this response is a bit late.
    Thanks for answering, and you are definitely not too late. I am still in need of help on how to get the admin site's graphics working.

    I'm attaching my urls.py.




  • Re: How to correct missing template error
    Board » Django » Views
    you need a template file called 'login.html' in the directory 'registration' (ie. registration/login.html) under one of the paths listed in your settings.py under TEMPLATE_DIRS .. is this the case for you?
    Thanks. That did it.
  • Re: How to correct missing template error
    Board » Django » Views
    I have templates. Could they not be seen properly?

    base.html
    <html>
        <head>
            <title>{% block title %}{% endblock %} </title>
        </head>
    
        <body>
            <h1>{% block head %}{% endblock %}</h1>
            {% block content %}{% endblock %}
            <br>
            <br>
            <br>
            <a href="/">Main page</a>
            {% if user.is_authenticated %}
                <a href="/logout">Log out</a>
            {% else %}
                <a href="/login/">Log in</a>
            {% endif %} 
        </body>
    </html>
    

    login.html
    {% extends "base.html" %}
    {% block title %}Log in{% endblock %}
    {% block head %}Log in{% endblock %}
    {% block content %}
        {% if form.has_errors %}
            <p>Username or password didn't work. 
                Please enter them again.</p>
        {% endif %}
    
        <form method="post" action=".">
            <p><label for="id_username">Username:
                </label>{{ form.username }}</p>
            <p><label for="id_password">Password:
                </label>{{ form.password }}</p>
            <input type="hidden" name="next"
                value="/" />
            <input type="submit" value="Log in" />
        </form>
    {% endblock %}
    

    main_page.html
    {% extends "base.html" %}
    
    
    {% block title %}Welcome User{% endblock %}
    {% block head %}Welcome User{% endblock %}
    
    
    
    {% block content %}
        {% if user.username %}
            <p>Hello {{ user.username }}</p>
        {% else %}
            <p>Please <a href="/login">log in</a>.</p>
        {% endif %}
    {% endblock %}
    

    you have to create a login.html template in one of your TEMPLATE_DIRS see the django documentation for an example: http://docs.djangoproject.com/en/1.2/topics/auth/#django.contrib.auth.views.login

    it looks like:

    {% extends "base.html" %}
    
    {% block content %}
    
    {% if form.errors %}
    <p>Your username and password didn't match. Please try again.</p>
    {% endif %}
    
    <form method="post" action="{% url django.contrib.auth.views.login %}">
    {% csrf_token %}
    <table>
    <tr>
        <td>{{ form.username.label_tag }}</td>
        <td>{{ form.username }}</td>
    </tr>
    <tr>
        <td>{{ form.password.label_tag }}</td>
        <td>{{ form.password }}</td>
    </tr>
    </table>
    
    <input type="submit" value="login" />
    <input type="hidden" name="next" value="{{ next }}" />
    </form>
    
    {% endblock %}
    



  • How to correct missing template error
    Board » Django » Views
    I have the following entries in urls.py
    from django.conf.urls.defaults import *
    from django.contrib.auth.views import login
    .
    .
    .
    urlpatterns = patterns('',
        (r'^$', main_page),
        (r'^login/$', 'django.contrib.auth.views.login'),
     )
    
    


    I am getting
    Exception Type:  	TemplateDoesNotExist
    Exception Value: 	
    
    registration/login.html
    


    after pressing login.

    What configuration do I need fix this problem?
    I can post anything else needed. Thank you.
  • Deploying On Apache
    Board » Getting Started » Setup and Configuration
    I have looked at a lot of examples, but need to find the best way to configure my django application for apache. The following does not work, and I have tried a bunch of different configurations with no luck.

    This application works fine under runserver.

    As to RTFM, I have searched the web for documentation and tried a lot of different things with no luck.
    Any help would be appreciated.
    Thank you.

    Listen 8002
    <VirtualHost _default_:8002>
    <Location "/home/amr/django/amr/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE amr.settings
    PythonOption django.root /home/amr/django/amr
    PythonDebug On
    PythonPath "['/home/amr/django/amr', '/usr/local/lib/python2.6/site-pack
    ages/django'] + sys.path"
    </Location>

    ServerAdmin dbadmin@town.arlington.ma.us
    </VirtualHost>


    --- Last Edited by octopusgrabbus at 2010-09-23 17:41:58 ---
  • Missing Full Graphics With Apache Configuration
    Board » Getting Started » Setup and Configuration
    If I log into Django admin with the runserver running, I get nice graphics on the page. If I log in using my configuration in Apache, the graphics are not there.

    What configuration am I missing in my Apache configuration?

    Thanks for your help. I've posted my apache configuration below.
    cmn

    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE amr.settings
    PythonOption django.root /home/amr/django/amr
    PythonDebug On
    PythonPath "['/home/amr/django/amr', '/var/www/AMRserver'] + sys.path"
    </Location>

    #
    # Virtual hosts
    #
    Listen 8002
    <VirtualHost _default_:8002>

    ServerAdmin someone@somewhere.com
    DirectoryIndex index.html
    DocumentRoot "/var/www/AMRserver/html"
    <Directory "/var/www/AMRserver/html">
    Options +Includes
    </Directory>
    </VirtualHost>


    --- Last Edited by octopusgrabbus at 2010-09-23 17:43:06 ---
  • Re: Admin site not formatted
    Board » Getting Started » Setup and Configuration
    I'll try this and post the results. Thanks for the answer.
  • Admin site not formatted
    Board » Getting Started » Setup and Configuration
    This post is related to apache configuration posted yesterday.
    Using apache and not the built-in web server, I can reach the admin site, but it's not formatted well, as it is with the built-in web server.

    Any ideas on what to do?

    Here's the location directive in apache

    <Location "/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE chapter4.settings
    PythonOption django.root /home/amr/web/django/chapter4
    PythonPath "['/home/amr/web/django/'] + ['/home/amr/web/django/favorites/'] + sys.path
    "
    PythonDebug On
    </Location>


Powered by Sphene Community Tools