I’m taking a Udemy course by Nick Walter and rather than copying line by 
line, I’m trying to branch out and experiment on my own.  

The purpose of the website I am creating is for a small blog, with the 
ability to redact string input (in an HTML form) from the user. There is 
also a word counter for the body content of the blog.

I got Django running but as soon as I started adding the code I wrote, 
Django stopped running properly. 

Here is the traceback in full: https://pastebin.com/8HtdNwPP 

The main issue shows at the bottom:

File 
> "/home/<user>/dev/projects/python/2018-and-2019/CC_Redact_Iter2/CC_Redact_Iter2/urls.py",
>  
> line 28, in <module>
>    * path('^james/', views.posts, name='james'),*
> *AttributeError: module 'counters.views' has no attribute 'posts’*



Based on this traceback, I gather I have probably misnamed a function or a 
file name or template but I can’t for the life of me figure which one or 
where. 

My entire source code repo can be found here: 
https://github.com/Angeles4four/CC_Redact_Iter2

Here are some of the relevant files involved.

urls.py:

from django.contrib import admin
> from django.urls import path
> # from . import views
> from posts import views
> from redactors import views
> from counters import views
> urlpatterns = [
>   path('admin/', admin.site.urls),
>   path('^$', views.home, name='home'),
>   path('^result/', views.result, name='result'),
>   path('^seth/', views.counters, name='seth'),
>   path('^james/', views.posts, name='james'),
>   path('^james/', views.redactors, name='simon'),
> ]



counters/views.py:

from django.http import HttpResponse
> from django.shortcuts import render
> def home(request):
>   if 'ccEntry' in request.GET:
>       number = request.GET['ccEntry']
>       redacted_num = 'xxxx xxxx xxxx {}'.format(number[-4:])
>       return render(request, 'result.html', {'number':number, 
> 'redacted_num':redacted_num})
>   else:
>       return render(request, 'home.html')
> def result(request):
>    return render(request, 'result.html')
> def counters(request):
>   return render(request, 'counters/james.html')


Here is my file tree: https://imgur.com/a/BUTKKEH

Contents of requirements.txt:

> Django==2.0.13
> Pillow==5.4.1
> psycopg2==2.7.7
> psycopg2-binary==2.7.7
> pytz==2018.9



If there are other files in my project that you wish to view, you can click 
through the file tree as it appears on GitHub (linked to above).

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/353c83b5-1f37-4e23-b6c7-f488cb05805e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to