We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Move user/account-related templates out of `threads` app
### Idea summary

There are several user- and account-related templates in the `threads` app. They should reside in the `accounts` app instead.

### Further details

Move all of the following templates from the `threads` app to the `accounts` app:

- [ ] `threads/templates/threads/base/less_headers/account_less.html` -> `accounts/templates/accounts/base/less_headers/account_less.html`
- [ ] `threads/templates/threads/base/less_headers/login_less.html` -> `accounts/templates/accounts/base/less_headers/login_less.html`
- [ ]  `threads/templates/threads/partials/account/*` to `accounts/templates/accounts/partials/account/*`
- [ ]  `threads/templates/threads/partials/feed/*` to `accounts/templates/accounts/partials/feed/*`
- [ ]  `threads/templates/threads/partials/login/*` to `accounts/templates/accounts/partials/login/*`
- [ ]  `threads/templates/threads/partials/user-setup/*` to `accounts/templates/accounts/partials/user-setup/*`
- [ ] `threads/templates/threads/user/*` -> `accounts/templates/accounts/*`
- [ ] `threads/templates/threads/account.html` -> `accounts/templates/accounts/account.html`
- [ ] `threads/templates/threads/feed.html` -> `accounts/templates/accounts/feed.html`
- [ ] `threads/templates/threads/invite.html` -> `accounts/templates/accounts/invite.html`
- [ ] `threads/templates/threads/user-setup.html` -> `accounts/templates/accounts/user-setup.html`
- [ ] make sure to fix all imports related to the moved files

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `project/accounts/views.py`
Content:
```
1 """
2 Class based views.
3 
4 This module will include views for the accounts app.
5 """
6 
7 from django.conf import settings
8 from django.contrib.auth.mixins import LoginRequiredMixin
9 from django.views.generic.edit import FormView, UpdateView
10 from django.views import View
11 from django.contrib.auth import views as auth_views
12 from django.contrib.auth import login
13 from django.contrib.sites.shortcuts import get_current_site
14 from django.urls import reverse_lazy
15 from django.contrib.auth import get_user_model
16 from django.utils.encoding import force_str
17 from django.utils.http import urlsafe_base64_decode
18 from django.template.response import TemplateResponse
19 from accounts.models import Profile
20 from accounts.forms import UserRegistrationForm, ProfileEditForm
21 from accounts.authentication import send_activation_email, account_activation_token
22 from django.http import HttpResponseRedirect
23 
24 
25 class RegisterView(FormView):
26     """
27     A form view that handles user registration.
28     """
29 
30     template_name = "accounts/register/register.html"
31     form_class = UserRegistrationForm
32     success_url = "/"
33 
34     def _create_user(self, form):
35         username = form.cleaned_data["username"]
36         password = form.cleaned_data["password"]
37         email = form.cleaned_data["email"]
38 
39         user = get_user_model().objects.create_user(username, email, password)
40         Profile.objects.create(user=user)
41 
42         return user
43 
44     def _send_email(self, user):
45         domain = get_current_site(self.request).domain
46         send_activation_email(user, domain)
47 
48     def _login(self, user):
49         login(self.request, user)
50 
51     def form_valid(self, form):
52         user = self._create_user(form)
53 
54         self._send_email(user)
55         self._login(user)
56 
57         return super(RegisterView, self).form_valid(form)
58 
59 
60 class PasswordResetView(auth_views.PasswordResetView):
61     template_name = "accounts/users/password_reset.html"
62     email_template_name = "accounts/users/password_reset_email.html"
63     subject_template_name = "accounts/users/password_reset_subject.txt"
64     from_email = settings.EMAIL_HOST_USER
65     success_url = reverse_lazy("accounts_password_reset_done")
66 
67 
68 class PasswordResetDoneView(auth_views.PasswordResetDoneView):
69     template_name = "accounts/users/password_reset_done.html"
70 
71 
72 class PasswordResetConfirmView(auth_views.PasswordResetConfirmView):
73     template_name = "accounts/users/password_reset_confirm.html"
74     success_url = reverse_lazy("accounts_password_reset_complete")
75 
76 
77 class PasswordResetCompleteView(auth_views.PasswordResetCompleteView):
78     template_name = "accounts/users/password_reset_complete.html"
79 
80 
81 class SettingsView(LoginRequiredMixin, UpdateView):
82     """A form view to edit Profile"""
83 
84     login_url = 'accounts_login'
85     form_class = ProfileEditForm
86     success_url = reverse_lazy('accounts_settings')
87     template_name = 'accounts/utils/update_settings.html'
88 
89     def get_object(self, queryset=None):
90         return Profile.objects.get(user=self.request.user)
91 
92     def get_initial(self):
93         profile = Profile.objects.get(user=self.request.user)
94         self.initial.update({
95             "username": profile.user.username,
96             "email": profile.user.email,
97             "first_name": profile.first_name or None,
98             "last_name": profile.last_name or None,
99             "about_me": profile.about_me or None,
100         })
101         return super(SettingsView, self).get_initial()
102 
103 
104 class ProfileActivationView(View):
105     """
106         This shows different views to the user when they are verifying
107         their account based on whether they are already verified or not.
108     """
109 
110     def get(self, request, uidb64, token):
111 
112         User = get_user_model()
113         try:
114             uid = force_str(urlsafe_base64_decode(uidb64))
115             user = User.objects.get(pk=uid)
116 
117         except (TypeError, ValueError, OverflowError, User.DoesNotExist):
118             user = None
119 
120         if user is not None and account_activation_token.check_token(user, token):
121             profile = Profile.objects.get(user=user)
122             if profile.is_verified:
123                 redirect_link = {"href": "/", "label": "Back to Main"}
124                 template_var = {
125                     "title": "Email Already Verified",
126                     "content": "You have already verified your email",
127                     "link": redirect_link,
128                 }
129                 return TemplateResponse(request, "general-message.html", template_var)
130             else:
131                 profile.is_verified = True
132                 profile.save()
133 
134                 redirect_link = {"href": "/", "label": "Back to Main"}
135                 template_var = {
136                     "title": "Email Verification Successful",
137                     "content": "Thank you for verifying your email with CiviWiki",
138                     "link": redirect_link,
139                 }
140                 return TemplateResponse(request, "general-message.html", template_var)
141         else:
142             # invalid link
143             redirect_link = {"href": "/", "label": "Back to Main"}
144             template_var = {
145                 "title": "Email Verification Error",
146                 "content": "Email could not be verified",
147                 "link": redirect_link,
148             }
149             return TemplateResponse(request, "general-message.html", template_var)
150 
151 
152 class ProfileSetupView(LoginRequiredMixin, View):
153     """A view to make the user profile full_profile"""
154 
155     login_url = 'accounts_login'
156 
157     def get(self, request):
158         profile = Profile.objects.get(user=request.user)
159         if profile.full_profile:
160             return HttpResponseRedirect("/")
161             # start temp rep rendering TODO: REMOVE THIS
162         else:
163             data = {
164                 "username": request.user.username,
165                 "email": request.user.email,
166             }
167             return TemplateResponse(request, "user-setup.html", data)
168
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/project/accounts/views.py b/project/accounts/views.py
--- a/project/accounts/views.py
+++ b/project/accounts/views.py
@@ -164,4 +164,4 @@
                 "username": request.user.username,
                 "email": request.user.email,
             }
-            return TemplateResponse(request, "user-setup.html", data)
+            return TemplateResponse(request, "accounts/user-setup.html", data)

{"golden_diff": "diff --git a/project/accounts/views.py b/project/accounts/views.py\n--- a/project/accounts/views.py\n+++ b/project/accounts/views.py\n@@ -164,4 +164,4 @@\n                 \"username\": request.user.username,\n                 \"email\": request.user.email,\n             }\n-            return TemplateResponse(request, \"user-setup.html\", data)\n+            return TemplateResponse(request, \"accounts/user-setup.html\", data)\n", "issue": "Move user/account-related templates out of `threads` app\n### Idea summary\r\n\r\nThere are several user- and account-related templates in the `threads` app. They should reside in the `accounts` app instead.\r\n\r\n### Further details\r\n\r\nMove all of the following templates from the `threads` app to the `accounts` app:\r\n\r\n- [ ] `threads/templates/threads/base/less_headers/account_less.html` -> `accounts/templates/accounts/base/less_headers/account_less.html`\r\n- [ ] `threads/templates/threads/base/less_headers/login_less.html` -> `accounts/templates/accounts/base/less_headers/login_less.html`\r\n- [ ]  `threads/templates/threads/partials/account/*` to `accounts/templates/accounts/partials/account/*`\r\n- [ ]  `threads/templates/threads/partials/feed/*` to `accounts/templates/accounts/partials/feed/*`\r\n- [ ]  `threads/templates/threads/partials/login/*` to `accounts/templates/accounts/partials/login/*`\r\n- [ ]  `threads/templates/threads/partials/user-setup/*` to `accounts/templates/accounts/partials/user-setup/*`\r\n- [ ] `threads/templates/threads/user/*` -> `accounts/templates/accounts/*`\r\n- [ ] `threads/templates/threads/account.html` -> `accounts/templates/accounts/account.html`\r\n- [ ] `threads/templates/threads/feed.html` -> `accounts/templates/accounts/feed.html`\r\n- [ ] `threads/templates/threads/invite.html` -> `accounts/templates/accounts/invite.html`\r\n- [ ] `threads/templates/threads/user-setup.html` -> `accounts/templates/accounts/user-setup.html`\r\n- [ ] make sure to fix all imports related to the moved files\n", "before_files": [{"content": "\"\"\"\nClass based views.\n\nThis module will include views for the accounts app.\n\"\"\"\n\nfrom django.conf import settings\nfrom django.contrib.auth.mixins import LoginRequiredMixin\nfrom django.views.generic.edit import FormView, UpdateView\nfrom django.views import View\nfrom django.contrib.auth import views as auth_views\nfrom django.contrib.auth import login\nfrom django.contrib.sites.shortcuts import get_current_site\nfrom django.urls import reverse_lazy\nfrom django.contrib.auth import get_user_model\nfrom django.utils.encoding import force_str\nfrom django.utils.http import urlsafe_base64_decode\nfrom django.template.response import TemplateResponse\nfrom accounts.models import Profile\nfrom accounts.forms import UserRegistrationForm, ProfileEditForm\nfrom accounts.authentication import send_activation_email, account_activation_token\nfrom django.http import HttpResponseRedirect\n\n\nclass RegisterView(FormView):\n    \"\"\"\n    A form view that handles user registration.\n    \"\"\"\n\n    template_name = \"accounts/register/register.html\"\n    form_class = UserRegistrationForm\n    success_url = \"/\"\n\n    def _create_user(self, form):\n        username = form.cleaned_data[\"username\"]\n        password = form.cleaned_data[\"password\"]\n        email = form.cleaned_data[\"email\"]\n\n        user = get_user_model().objects.create_user(username, email, password)\n        Profile.objects.create(user=user)\n\n        return user\n\n    def _send_email(self, user):\n        domain = get_current_site(self.request).domain\n        send_activation_email(user, domain)\n\n    def _login(self, user):\n        login(self.request, user)\n\n    def form_valid(self, form):\n        user = self._create_user(form)\n\n        self._send_email(user)\n        self._login(user)\n\n        return super(RegisterView, self).form_valid(form)\n\n\nclass PasswordResetView(auth_views.PasswordResetView):\n    template_name = \"accounts/users/password_reset.html\"\n    email_template_name = \"accounts/users/password_reset_email.html\"\n    subject_template_name = \"accounts/users/password_reset_subject.txt\"\n    from_email = settings.EMAIL_HOST_USER\n    success_url = reverse_lazy(\"accounts_password_reset_done\")\n\n\nclass PasswordResetDoneView(auth_views.PasswordResetDoneView):\n    template_name = \"accounts/users/password_reset_done.html\"\n\n\nclass PasswordResetConfirmView(auth_views.PasswordResetConfirmView):\n    template_name = \"accounts/users/password_reset_confirm.html\"\n    success_url = reverse_lazy(\"accounts_password_reset_complete\")\n\n\nclass PasswordResetCompleteView(auth_views.PasswordResetCompleteView):\n    template_name = \"accounts/users/password_reset_complete.html\"\n\n\nclass SettingsView(LoginRequiredMixin, UpdateView):\n    \"\"\"A form view to edit Profile\"\"\"\n\n    login_url = 'accounts_login'\n    form_class = ProfileEditForm\n    success_url = reverse_lazy('accounts_settings')\n    template_name = 'accounts/utils/update_settings.html'\n\n    def get_object(self, queryset=None):\n        return Profile.objects.get(user=self.request.user)\n\n    def get_initial(self):\n        profile = Profile.objects.get(user=self.request.user)\n        self.initial.update({\n            \"username\": profile.user.username,\n            \"email\": profile.user.email,\n            \"first_name\": profile.first_name or None,\n            \"last_name\": profile.last_name or None,\n            \"about_me\": profile.about_me or None,\n        })\n        return super(SettingsView, self).get_initial()\n\n\nclass ProfileActivationView(View):\n    \"\"\"\n        This shows different views to the user when they are verifying\n        their account based on whether they are already verified or not.\n    \"\"\"\n\n    def get(self, request, uidb64, token):\n\n        User = get_user_model()\n        try:\n            uid = force_str(urlsafe_base64_decode(uidb64))\n            user = User.objects.get(pk=uid)\n\n        except (TypeError, ValueError, OverflowError, User.DoesNotExist):\n            user = None\n\n        if user is not None and account_activation_token.check_token(user, token):\n            profile = Profile.objects.get(user=user)\n            if profile.is_verified:\n                redirect_link = {\"href\": \"/\", \"label\": \"Back to Main\"}\n                template_var = {\n                    \"title\": \"Email Already Verified\",\n                    \"content\": \"You have already verified your email\",\n                    \"link\": redirect_link,\n                }\n                return TemplateResponse(request, \"general-message.html\", template_var)\n            else:\n                profile.is_verified = True\n                profile.save()\n\n                redirect_link = {\"href\": \"/\", \"label\": \"Back to Main\"}\n                template_var = {\n                    \"title\": \"Email Verification Successful\",\n                    \"content\": \"Thank you for verifying your email with CiviWiki\",\n                    \"link\": redirect_link,\n                }\n                return TemplateResponse(request, \"general-message.html\", template_var)\n        else:\n            # invalid link\n            redirect_link = {\"href\": \"/\", \"label\": \"Back to Main\"}\n            template_var = {\n                \"title\": \"Email Verification Error\",\n                \"content\": \"Email could not be verified\",\n                \"link\": redirect_link,\n            }\n            return TemplateResponse(request, \"general-message.html\", template_var)\n\n\nclass ProfileSetupView(LoginRequiredMixin, View):\n    \"\"\"A view to make the user profile full_profile\"\"\"\n\n    login_url = 'accounts_login'\n\n    def get(self, request):\n        profile = Profile.objects.get(user=request.user)\n        if profile.full_profile:\n            return HttpResponseRedirect(\"/\")\n            # start temp rep rendering TODO: REMOVE THIS\n        else:\n            data = {\n                \"username\": request.user.username,\n                \"email\": request.user.email,\n            }\n            return TemplateResponse(request, \"user-setup.html\", data)\n", "path": "project/accounts/views.py"}], "after_files": [{"content": "\"\"\"\nClass based views.\n\nThis module will include views for the accounts app.\n\"\"\"\n\nfrom django.conf import settings\nfrom django.contrib.auth.mixins import LoginRequiredMixin\nfrom django.views.generic.edit import FormView, UpdateView\nfrom django.views import View\nfrom django.contrib.auth import views as auth_views\nfrom django.contrib.auth import login\nfrom django.contrib.sites.shortcuts import get_current_site\nfrom django.urls import reverse_lazy\nfrom django.contrib.auth import get_user_model\nfrom django.utils.encoding import force_str\nfrom django.utils.http import urlsafe_base64_decode\nfrom django.template.response import TemplateResponse\nfrom accounts.models import Profile\nfrom accounts.forms import UserRegistrationForm, ProfileEditForm\nfrom accounts.authentication import send_activation_email, account_activation_token\nfrom django.http import HttpResponseRedirect\n\n\nclass RegisterView(FormView):\n    \"\"\"\n    A form view that handles user registration.\n    \"\"\"\n\n    template_name = \"accounts/register/register.html\"\n    form_class = UserRegistrationForm\n    success_url = \"/\"\n\n    def _create_user(self, form):\n        username = form.cleaned_data[\"username\"]\n        password = form.cleaned_data[\"password\"]\n        email = form.cleaned_data[\"email\"]\n\n        user = get_user_model().objects.create_user(username, email, password)\n        Profile.objects.create(user=user)\n\n        return user\n\n    def _send_email(self, user):\n        domain = get_current_site(self.request).domain\n        send_activation_email(user, domain)\n\n    def _login(self, user):\n        login(self.request, user)\n\n    def form_valid(self, form):\n        user = self._create_user(form)\n\n        self._send_email(user)\n        self._login(user)\n\n        return super(RegisterView, self).form_valid(form)\n\n\nclass PasswordResetView(auth_views.PasswordResetView):\n    template_name = \"accounts/users/password_reset.html\"\n    email_template_name = \"accounts/users/password_reset_email.html\"\n    subject_template_name = \"accounts/users/password_reset_subject.txt\"\n    from_email = settings.EMAIL_HOST_USER\n    success_url = reverse_lazy(\"accounts_password_reset_done\")\n\n\nclass PasswordResetDoneView(auth_views.PasswordResetDoneView):\n    template_name = \"accounts/users/password_reset_done.html\"\n\n\nclass PasswordResetConfirmView(auth_views.PasswordResetConfirmView):\n    template_name = \"accounts/users/password_reset_confirm.html\"\n    success_url = reverse_lazy(\"accounts_password_reset_complete\")\n\n\nclass PasswordResetCompleteView(auth_views.PasswordResetCompleteView):\n    template_name = \"accounts/users/password_reset_complete.html\"\n\n\nclass SettingsView(LoginRequiredMixin, UpdateView):\n    \"\"\"A form view to edit Profile\"\"\"\n\n    login_url = 'accounts_login'\n    form_class = ProfileEditForm\n    success_url = reverse_lazy('accounts_settings')\n    template_name = 'accounts/utils/update_settings.html'\n\n    def get_object(self, queryset=None):\n        return Profile.objects.get(user=self.request.user)\n\n    def get_initial(self):\n        profile = Profile.objects.get(user=self.request.user)\n        self.initial.update({\n            \"username\": profile.user.username,\n            \"email\": profile.user.email,\n            \"first_name\": profile.first_name or None,\n            \"last_name\": profile.last_name or None,\n            \"about_me\": profile.about_me or None,\n        })\n        return super(SettingsView, self).get_initial()\n\n\nclass ProfileActivationView(View):\n    \"\"\"\n        This shows different views to the user when they are verifying\n        their account based on whether they are already verified or not.\n    \"\"\"\n\n    def get(self, request, uidb64, token):\n\n        User = get_user_model()\n        try:\n            uid = force_str(urlsafe_base64_decode(uidb64))\n            user = User.objects.get(pk=uid)\n\n        except (TypeError, ValueError, OverflowError, User.DoesNotExist):\n            user = None\n\n        if user is not None and account_activation_token.check_token(user, token):\n            profile = Profile.objects.get(user=user)\n            if profile.is_verified:\n                redirect_link = {\"href\": \"/\", \"label\": \"Back to Main\"}\n                template_var = {\n                    \"title\": \"Email Already Verified\",\n                    \"content\": \"You have already verified your email\",\n                    \"link\": redirect_link,\n                }\n                return TemplateResponse(request, \"general-message.html\", template_var)\n            else:\n                profile.is_verified = True\n                profile.save()\n\n                redirect_link = {\"href\": \"/\", \"label\": \"Back to Main\"}\n                template_var = {\n                    \"title\": \"Email Verification Successful\",\n                    \"content\": \"Thank you for verifying your email with CiviWiki\",\n                    \"link\": redirect_link,\n                }\n                return TemplateResponse(request, \"general-message.html\", template_var)\n        else:\n            # invalid link\n            redirect_link = {\"href\": \"/\", \"label\": \"Back to Main\"}\n            template_var = {\n                \"title\": \"Email Verification Error\",\n                \"content\": \"Email could not be verified\",\n                \"link\": redirect_link,\n            }\n            return TemplateResponse(request, \"general-message.html\", template_var)\n\n\nclass ProfileSetupView(LoginRequiredMixin, View):\n    \"\"\"A view to make the user profile full_profile\"\"\"\n\n    login_url = 'accounts_login'\n\n    def get(self, request):\n        profile = Profile.objects.get(user=request.user)\n        if profile.full_profile:\n            return HttpResponseRedirect(\"/\")\n            # start temp rep rendering TODO: REMOVE THIS\n        else:\n            data = {\n                \"username\": request.user.username,\n                \"email\": request.user.email,\n            }\n            return TemplateResponse(request, \"accounts/user-setup.html\", data)\n", "path": "project/accounts/views.py"}]}