input: Write a python function to create a directory, a virtual environment, install Django and Django Rest Framework, and start a new Django project with an app.
  assert create_django_project('myproject', 'myapp') == "Django project 'myproject' with app 'myapp' created successfully."
  assert create_django_project('testproject', 'testapp') == "Django project 'testproject' with app 'testapp' created successfully."
output: import os
  import subprocess
  import sys
  import venv
  
  def create_django_project(project_name, app_name):
      try:
          # Create project directory
          os.makedirs(project_name, exist_ok=True)
          
          # Create virtual environment
          env_path = os.path.join(project_name, 'env')
          venv.create(env_path, with_pip=True)
          
          # Activate virtual environment
          if os.name == 'nt':
              activate_script = os.path.join(env_path, 'Scripts', 'activate')
          else:
              activate_script = os.path.join(env_path, 'bin', 'activate')
          
          # Install Django and Django Rest Framework
          subprocess.run(f"{activate_script} && pip install django djangorestframework", shell=True, check=True)
          
          # Start a new Django project
          subprocess.run(f"{activate_script} && django-admin startproject {project_name} .", shell=True, cwd=project_name, check=True)
          
          # Create a new Django app
          subprocess.run(f"{activate_script} && python manage.py startapp {app_name}", shell=True, cwd=project_name, check=True)
          
          return f"Django project '{project_name}' with app '{app_name}' created successfully."
      except Exception as e:
          return str(e)