Needs help

24 views
Skip to first unread message

Umar Kambala

unread,
Jul 9, 2018, 7:53:00 AM7/9/18
to django...@googlegroups.com

Am lost as to what to do, I try troubleshooting but couldn't fine de answer... This are my codes

from django.contrib.auth.models import User from django.shortcuts import render, redirect, get_object_or_404 from .models import Board, Topic, Post def new_topic(request, pk): board = get_object_or_404(Board, pk=pk) if request.method == 'POST': subject = request.POST['subject'] message = request.POST['message'] user = User.objects.first() # TODO: get the currently logged in user topic = Topic.objects.create( subject=subject, board=board, starter=user ) post = Post.objects.create( message=message, topic=topic, created_by=user ) return redirect('board_topics', pk=board.pk) # TODO: redirect to the created topic page return render(request, 'new_topic.html', {'board': board})

This is the error

url(r'^$', views.home, name='home')
attributeError: module 'boards.views' has no attribute 'home'

Kasper Laudrup

unread,
Jul 9, 2018, 7:57:56 AM7/9/18
to django...@googlegroups.com
Hi Umar.

On 07/09/2018 01:52 PM, Umar Kambala wrote:
>
> This is the error
>
> url(r'^$', views.home, name='home')
> attributeError: module 'boards.views' has no attribute 'home'
>

Do you know what a Python module is and what an attribute on a module
means? Then the answer is obvious.

Try to read up on that.

Kind regards,

Kasper Laudrup

Umar Kambala

unread,
Jul 9, 2018, 8:04:16 AM7/9/18
to django...@googlegroups.com

Thanks

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9a2b1e04-5f45-ecd5-6d43-17f247a6836c%40stacktrace.dk.
For more options, visit https://groups.google.com/d/optout.

Umar Kambala

unread,
Jul 12, 2018, 4:40:48 AM7/12/18
to django...@googlegroups.com

Kasper thanks for your brotherly advice, please I will be glad next time u add me a link. But I came across another error, when I run python manage.py runserver everything work find but when I enter 127.0.0.1 I gets "no internet connection" do I hv to be connected wit internet before I can access de local server?

On Jul 9, 2018 11:57 AM, "Kasper Laudrup" <lau...@stacktrace.dk> wrote:

Mike Dewhirst

unread,
Jul 12, 2018, 5:01:49 AM7/12/18
to django...@googlegroups.com
Try http://127.0.0.1:8000

On 12/07/2018 6:40 PM, Umar Kambala wrote:
>
> Kasper thanks for your brotherly advice, please I will be glad next
> time u add me a link. But I came across another error, when I run
> python manage.py runserver everything work find but when I enter
> 127.0.0.1 I gets "no internet connection" do I hv to be connected wit
> internet before I can access de local server?
>
> On Jul 9, 2018 11:57 AM, "Kasper Laudrup" <lau...@stacktrace.dk
> <mailto:lau...@stacktrace.dk>> wrote:
>
> Hi Umar.
>
> On 07/09/2018 01:52 PM, Umar Kambala wrote:
>
>
> This is the error
>
> url(r'^$', views.home, name='home')
> attributeError: module 'boards.views' has no attribute 'home'
>
>
> Do you know what a Python module is and what an attribute on a
> module means? Then the answer is obvious.
>
> Try to read up on that.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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...@googlegroups.com
> <mailto:django-users%2Bunsu...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@googlegroups.com>.
> <https://groups.google.com/group/django-users>.
> <https://groups.google.com/d/msgid/django-users/9a2b1e04-5f45-ecd5-6d43-17f247a6836c%40stacktrace.dk>.
> For more options, visit https://groups.google.com/d/optout
> <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...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPkbFbYeTZU6G0rtcpQ9Cgm6qf--cD-JfhO4dwNYHD-eUjr_fw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPkbFbYeTZU6G0rtcpQ9Cgm6qf--cD-JfhO4dwNYHD-eUjr_fw%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Kasper Laudrup

unread,
Jul 12, 2018, 6:13:13 AM7/12/18
to django...@googlegroups.com
Hi Umar,

On 2018-07-12 10:40, Umar Kambala wrote:
> Kasper thanks for your brotherly advice, please I will be glad next time
> u add me a link.

As I mentioned before, I think you should pick up a beginner book on
Python programming.

I personally read a book called "Dive into Python" some years ago which
was quite good although it might be slightly outdated now. But that book
is for someone who already has experience with other programming
languages, which doesn't seem to be your case, so I couldn't recommend
that in your case.

Anyway, there are tons of tutorials on Python programming for beginners.
I don't know which ones to recommend, but maybe someone else can be helpful.

> But I came across another error, when I run python
> manage.py runserver everything work find but when I enter 127.0.0.1 I
> gets "no internet connection" do I hv to be connected wit internet
> before I can access de local server?
>

You've already asked that question and someone else already gave you an
answer. I cannot help debugging your internet connection. Ask you ISP or
wherever you get your connection from.

Kind regards,

Kasper Laudrup

Umar Kambala

unread,
Jul 12, 2018, 6:29:13 AM7/12/18
to django...@googlegroups.com

That's what I have been trying since, but it's not going through

On Jul 12, 2018 9:01 AM, "Mike Dewhirst" <mi...@dewhirst.com.au> wrote:
Try http://127.0.0.1:8000

On 12/07/2018 6:40 PM, Umar Kambala wrote:

Kasper thanks for your brotherly advice, please I will be glad next time u add me a link. But I came across another error, when I run python manage.py runserver everything work find but when I enter 127.0.0.1 I gets "no internet connection" do I hv to be connected wit internet before I can access de local server?

On Jul 9, 2018 11:57 AM, "Kasper Laudrup" <lau...@stacktrace.dk <mailto:lau...@stacktrace.dk>> wrote:

    Hi Umar.

    On 07/09/2018 01:52 PM, Umar Kambala wrote:


        This is the error

        url(r'^$', views.home, name='home')
        attributeError: module 'boards.views' has no attribute 'home'


    Do you know what a Python module is and what an attribute on a
    module means? Then the answer is obvious.

    Try to read up on that.

    Kind regards,

    Kasper Laudrup

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

    To post to this group, send email to django...@googlegroups.com

    Visit this group at https://groups.google.com/group/django-users
    <https://groups.google.com/group/django-users>.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/django-users/9a2b1e04-5f45-ecd5-6d43-17f247a6836c%40stacktrace.dk
    <https://groups.google.com/d/msgid/django-users/9a2b1e04-5f45-ecd5-6d43-17f247a6836c%40stacktrace.dk>.
    For more options, visit https://groups.google.com/d/optout
    <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+unsubscribe@googlegroups.com <mailto:django-users+unsubscrib...@googlegroups.com>.
To post to this group, send email to django...@googlegroups.com <mailto:django-users@googlegroups.com>.
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.

Kasper Laudrup

unread,
Jul 12, 2018, 6:32:41 AM7/12/18
to django...@googlegroups.com
Hi Umar,

On 2018-07-12 12:28, Umar Kambala wrote:
> That's what I have been trying since, but it's not going through
>

What have you been trying? I have no idea what you are replying to here?

Kind regards,

Kasper Laudrup
Reply all
Reply to author
Forward
0 new messages