title: Is there a way to integrate Django with Next.js?
body: <p>I've integrated Reactjs with Django by having a function to access <code>build/index.html</code>. The below codes show how I do that.</p>
  
  <p><strong>config/urls.py</strong></p>
  
  <pre><code>urlpatterns = [
      ...
      re_path(r'search/', react_views.ReactAppView.as_view()),
  ]
  </code></pre>
  
  <p><strong>PROJECT_NAME/views.py</strong></p>
  
  <pre><code>class ReactAppView(View):
  
      def get(self, request):
          try:
              with open(os.path.join(str(settings.BASE_DIR), 'frontend', 'build', 'index.html')) as file:
                  return HttpResponse(file.read())
          except:
              return HttpResponse(
                  """
                  Build your React app.
                  """,
                  status=501,
              )
  </code></pre>
  
  <p><code>ReactAppView</code> function accesses <code>index.html</code> which is created with <code>yarn build</code> on React side. Basically, I used React just for search view, and other than search view, I used jQuery as it was developed with jQuery first.</p>
  
  <p>Since I found that I need Next.js to use Server Side Rendering (SSR) with React, I've been trying to migrate React app to Next.js. But, Next.js doesn't have <code>index.html</code>. It just has <code>pages/index.js</code> instead.</p>
  
  <p>I've tried very hard to figure out how to integrate Django with Next.js, but I can't find any helpful resource. Can anyone help me about this?</p>