Help

37 views
Skip to first unread message

Umar Kambala

unread,
Jul 8, 2018, 7:44:13 AM7/8/18
to django...@googlegroups.com

class HomeTests(TestCase): def setUp(self): self.board = Board.objects.create(name='Django', description='Django board.') url = reverse('home') self.response = self.client.get(url) def test_home_view_status_code(self): self.assertEquals(self.response.status_code, 200) def test_home_url_resolves_home_view(self): view = resolve('/') self.assertEquals(view.func, home) def test_home_view_contains_link_to_topics_page(self): board_topics_url = reverse('board_topics', kwargs={'pk': self.board.pk}) self.assertContains(self.response, 'href="{0}"'.format(board_topics_url))

Please when I run python manage.py test I gets
IndentationError : unident does not match any outer indentation level.

mottaz hejaze

unread,
Jul 8, 2018, 10:10:24 AM7/8/18
to Django users
push the code to git repository

Jason

unread,
Jul 8, 2018, 11:24:09 AM7/8/18
to Django users
python is indentation sensitive, so if you don't do what the language expects, it'll have that error.

you really should use an ide or text editor with python integration, since you will catch these easy errors when they happen.

plus, take a look at what you posted above, with everything in one line.  kinda hard to see what indentiation is happening when you don't have any to show

Anirudh choudhary

unread,
Jul 8, 2018, 11:26:29 AM7/8/18
to Django users
HI Umar kambala 
 Indentation means if we consider a case to use a if loop then i can be written like 

if(condition):
       do this
else:
       else do this 

if you getting this error it may you have used the wrong syntax

Thank You
 

Kasper Laudrup

unread,
Jul 8, 2018, 12:21:16 PM7/8/18
to django...@googlegroups.com
Hi Umar,

On 2018-07-08 13:43, Umar Kambala wrote:
>
> Please when I run python manage.py test I gets
> IndentationError : unident does not match any outer indentation level.
>

Python uses indentation for scoping. This is, really, really basic
Python knowledge.

Looking at the questions you post here, I really suggest you pick up a
book or find an online tutorial on Python, since you seem to be missing
a lot of very basic stuff.

Take some time (it doesn't have to take that long, especially if you
have previous experience in other languages) to learn the basics of the
Python language, then you'll have a much more pleasant experience with
Django.

I don't mean to sound condescending, I really mean it in the most
friendly helpful way.

We've all been beginners (and people who claim to be experts are most
often not) and there's absolutely nothing wrong in that, but it sounds
like you're not really interested in understanding *why* you are getting
the errors you are getting and just look for an easy answer. You'll
never learn to program in Python, Django or anything else that way.

I'm deeply sorry if I've gotten the wrong impression, I am really trying
to be helpful.

Best of luck and kind regards,

Kasper Laudrup

Umar Kambala

unread,
Jul 8, 2018, 12:47:21 PM7/8/18
to django...@googlegroups.com

Waaw thanks for that brotherly advice given. Am really really grateful. Will try to do just that. Thanks once again.
Plz another problem is that when I run python manage.py runserver everything works find but when I opens my browser I gets "no internet connection" what might be de problem? 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/dfea6e65-cd35-062e-14b0-8abdd210f4a8%40stacktrace.dk.
For more options, visit https://groups.google.com/d/optout.

Jason

unread,
Jul 8, 2018, 12:50:55 PM7/8/18
to Django users
the error states the issue: your computer is not connected to the internet.



Umar Kambala

unread,
Jul 8, 2018, 12:57:46 PM7/8/18
to django...@googlegroups.com

Am being using de django server which is 127.0.0.1 and never had any problem till today.
Thanks

On Jul 8, 2018 4:51 PM, "Jason" <jjohn...@gmail.com> wrote:
the error states the issue: your computer is not connected to the internet.



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

Roger Gammans

unread,
Jul 8, 2018, 1:13:59 PM7/8/18
to django...@googlegroups.com
Umar,

IIRC - (and it's been a while since I used windows) - Windows maintains a global flag for internet connectivity. 

Unfortunately if windows decides it's not connected , bad many apps such as Internet Explorer, Edge etc, refuse to attempt to make any TCP connections even if they are to localhost (127.0.0.1). A quick google suggests that your AV or firewall could also cause this.

I hope this gives you a few places to look.

Umar Kambala

unread,
Jul 8, 2018, 1:48:52 PM7/8/18
to django...@googlegroups.com

Thank Roger

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

Umar Kambala

unread,
Jul 18, 2018, 10:34:01 AM7/18/18
to django...@googlegroups.com

I have been getting this error

ValueError at /signup/

The view accounts.views.signup didn't return an HttpResponse object. It returned None instead.

This are the codes

accounts/views.py

from django.contrib.auth import login as auth_login from django.contrib.auth.forms import UserCreationForm from django.shortcuts import render, redirect def signup(request): if request.method == 'POST': form = UserCreationForm(request.POST) if form.is_valid(): user = form.save() auth_login(request, user) return redirect('home') else: form = UserCreationForm() return render(request, 'signup.html', {'form': form})

Kasper Laudrup

unread,
Jul 18, 2018, 6:38:15 PM7/18/18
to Django users, Umar Kambala
Hi Umar,

First of all, please write to the mailing list instead of me personally.
That's one of the main points of a mailing list, that other people have
the chance to learn and help.

Now regarding the code you sent me:

On 2018-07-18 19:11, Umar Kambala wrote:
> *accounts/**views.py*
>
> from django.contrib.auth import login as auth_login
>
> from django.contrib.auth.forms import UserCreationForm
>
> from django.shortcuts import render, redirect
>
> def signup(request):
>    if request.method == 'POST':
>   form =  UserCreationForm(request.POST)
>
> if form.is_valid():
>      user = form.save()
>
>     auth_login(request, user)
> return redirect('home')
>
> else:
>
> form = UserCreationForm()
>
> return render(request, 'signup.html', {'form': form})
>
> This the code
>

I cannot believe this is the actual code you're trying to run. The
indentation is all wrong. It is quite clear why you return "None" from
your signup function. But among other things, there's no form variable
in scope in this code snippet, so the python interpreter would error out
when interpreting this file, so you wouldn't even get the error you
claim to be getting.

I've recommended that you learn some basic Python programming, probably
programming in general and even the basics of using a computer, but it
seems like you haven't listened.

I'm not gonna spend any more time trying to help you and recommend
others to do the same.

Learn some basics and stop wasting other peoples time until you've made
an effort to do that.

I really cannot put this in a nicer way.

Kind regards,

Kasper Laudrup
Reply all
Reply to author
Forward
0 new messages