title: NoReverseMatch at / Reverse for 'profile' with arguments '('',)' not found. 1 pattern(s) tried: ['profile/(?P<name>[^/]+)/$']
body: <p>I am a beginner in learning code and am working on making a simple django site where users can write comments but I keep getting this error</p>
  <p>My urls.py</p>
  <pre><code>from django.urls import path
  
  from . import views
  
  urlpatterns = [
      path(&quot;&quot;, views.index, name=&quot;index&quot;),
      path(&quot;login&quot;, views.login_view, name=&quot;login&quot;),
      path(&quot;logout&quot;, views.logout_view, name=&quot;logout&quot;),
      path(&quot;register&quot;, views.register, name=&quot;register&quot;),
      path(&quot;profile/&lt;str:name&gt;/&quot;, views.profile, name=&quot;profile&quot;)
  ]
  </code></pre>
  <p>views.py</p>
  <pre><code>class NewPostForm(forms.Form):
      title = forms.CharField(label=&quot;Title&quot;)
      description = forms.CharField(widget=forms.Textarea)
  
  def index(request):
      if request.method == &quot;POST&quot;:
          form = NewPostForm(request.POST)
          if form.is_valid():
              title = form.cleaned_data['title']
              description = form.cleaned_data['description']
              author = request.user
  
              post = NewPost(title=title, description=description, author=author)
              post.save()
              return HttpResponseRedirect(reverse(&quot;index&quot;))
          else:
              return render(request, &quot;network/index.html&quot;, {
                  &quot;form&quot;: form
              })
  
      return render(request, &quot;network/index.html&quot;, {
          &quot;form&quot;: NewPostForm(),
          &quot;posts&quot;: NewPost.objects.all()
      })
  </code></pre>
  <p>models.py</p>
  <pre><code>from django.contrib.auth.models import AbstractUser
  from django.db import models
  
  
  class User(AbstractUser):
      pass
  
  class NewPost(models.Model):
      title = models.CharField(max_length=32)
      description = models.CharField(max_length=256)
      author = models.ForeignKey(User, on_delete=models.CASCADE, null=True)
  </code></pre>
  <p>and my index.html</p>
  <pre><code>{% extends &quot;network/layout.html&quot; %}
  
  {% load static %}
  {% load crispy_forms_tags %}
  
  {% block body %}
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;form method=&quot;post&quot; action=&quot;{% url 'index' %}&quot;&gt;
              {% csrf_token %}
              {{form | crispy}}
              &lt;button class=&quot;btn btn-primary&quot;&gt; Post &lt;/button&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  
      {% for post in posts %}
          &lt;div class=&quot;card&quot;&gt;
              &lt;div class=&quot;card-body&quot;&gt; Title: {{post.title}} &lt;/div&gt;
              &lt;div class=&quot;card-body&quot;&gt; Description: {{post.description}}&lt;/div&gt;
              &lt;p&gt; {{post.author.username}} &lt;/p&gt;
              &lt;div class=&quot;card-body&quot;&gt;
                  &lt;a href=&quot;{% url 'profile' post.author.username %}&quot;&gt;
                      @{{post.author.username}}
                  &lt;/a&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      {% endfor %}
  {% endblock %}
  </code></pre>
  <p>But I keep getting</p>
  <p>NoReverseMatch at / Reverse for 'profile' with arguments '('',)' not found. 1 pattern(s) tried: ['profile/(?P[^/]+)/$']</p>