We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
StaticFilesConfig and virtual directories
I'm trying to write a ``FileSystemProtocol`` to load files from the package data using [importlib_resources](https://importlib-resources.readthedocs.io/en/latest/using.html#). But because ``directories`` is defined as ``DirectoryPath``, pydantic checks if the given directories exist in the local filesystem. 

This is not generally true, especially in any kind of virtual filesystem (e.g. a zipped package). I think this condition should be relaxed to support virtual filesystems.

https://github.com/starlite-api/starlite/blob/9bb6dcd57c10a591377cf8e3a537e9292566d5b9/starlite/config/static_files.py#L32

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `starlite/cli/commands/core.py`
Content:
```
1 import inspect
2 
3 from click import command, option
4 from rich.tree import Tree
5 
6 from starlite import HTTPRoute, Starlite, WebSocketRoute
7 from starlite.cli.utils import StarliteCLIException, StarliteEnv, console, show_app_info
8 from starlite.utils.helpers import unwrap_partial
9 
10 
11 @command(name="info")
12 def info_command(app: Starlite) -> None:
13     """Show information about the detected Starlite app."""
14 
15     show_app_info(app)
16 
17 
18 @command(name="run")
19 @option("-r", "--reload", help="Reload server on changes", default=False, is_flag=True)
20 @option("-p", "--port", help="Serve under this port", type=int, default=8000, show_default=True)
21 @option("--host", help="Server under this host", default="127.0.0.1", show_default=True)
22 @option("--debug", help="Run app in debug mode", is_flag=True)
23 def run_command(
24     reload: bool,
25     port: int,
26     host: str,
27     debug: bool,
28     env: StarliteEnv,
29     app: Starlite,
30 ) -> None:
31     """Run a Starlite app.
32 
33     The app can be either passed as a module path in the form of <module name>.<submodule>:<app instance or factory>,
34     set as an environment variable STARLITE_APP with the same format or automatically discovered from one of these
35     canonical paths: app.py, asgi.py, application.py or app/__init__.py. When autodiscovering application factories,
36     functions with the name ``create_app`` are considered, or functions that are annotated as returning a ``Starlite``
37     instance.
38     """
39 
40     try:
41         import uvicorn
42     except ImportError:
43         raise StarliteCLIException("Uvicorn needs to be installed to run an app")  # pylint: disable=W0707
44 
45     if debug or env.debug:
46         app.debug = True
47 
48     show_app_info(app)
49 
50     console.rule("[yellow]Starting server process", align="left")
51 
52     uvicorn.run(
53         env.app_path,
54         reload=env.reload or reload,
55         host=env.host or host,
56         port=env.port or port,
57         factory=env.is_app_factory,
58     )
59 
60 
61 @command(name="routes")
62 def routes_command(app: Starlite) -> None:  # pragma: no cover
63     """Display information about the application's routes."""
64 
65     tree = Tree("", hide_root=True)
66 
67     for route in sorted(app.routes, key=lambda r: r.path):
68         if isinstance(route, HTTPRoute):
69             branch = tree.add(f"[green]{route.path}[/green] (HTTP)")
70             for handler in route.route_handlers:
71                 handler_info = [
72                     f"[blue]{handler.name or handler.handler_name}[/blue]",
73                 ]
74 
75                 if inspect.iscoroutinefunction(unwrap_partial(handler.fn.value)):
76                     handler_info.append("[magenta]async[/magenta]")
77                 else:
78                     handler_info.append("[yellow]sync[/yellow]")
79 
80                 handler_info.append(f'[cyan]{", ".join(sorted(handler.http_methods))}[/cyan]')
81 
82                 if len(handler.paths) > 1:
83                     for path in handler.paths:
84                         branch.add(" ".join([f"[green]{path}[green]", *handler_info]))
85                 else:
86                     branch.add(" ".join(handler_info))
87 
88         else:
89             if isinstance(route, WebSocketRoute):
90                 route_type = "WS"
91             else:
92                 route_type = "ASGI"
93             branch = tree.add(f"[green]{route.path}[/green] ({route_type})")
94             branch.add(f"[blue]{route.route_handler.name or route.route_handler.handler_name}[/blue]")
95 
96     console.print(tree)
97
```
--- 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/starlite/cli/commands/core.py b/starlite/cli/commands/core.py
--- a/starlite/cli/commands/core.py
+++ b/starlite/cli/commands/core.py
@@ -1,4 +1,6 @@
 import inspect
+import subprocess
+from typing import Any, Dict, List
 
 from click import command, option
 from rich.tree import Tree
@@ -8,6 +10,18 @@
 from starlite.utils.helpers import unwrap_partial
 
 
+def _convert_uvicorn_args(args: Dict[str, Any]) -> List[str]:
+    process_args = []
+    for arg, value in args.items():
+        if isinstance(value, bool):
+            if value:
+                process_args.append(f"--{arg}")
+        else:
+            process_args.append(f"--{arg}={value}")
+
+    return process_args
+
+
 @command(name="info")
 def info_command(app: Starlite) -> None:
     """Show information about the detected Starlite app."""
@@ -38,24 +52,24 @@
     """
 
     try:
-        import uvicorn
+        import uvicorn  # noqa: F401
     except ImportError:
         raise StarliteCLIException("Uvicorn needs to be installed to run an app")  # pylint: disable=W0707
 
     if debug or env.debug:
         app.debug = True
 
-    show_app_info(app)
+    # invoke uvicorn in a subprocess to be able to use the --reload flag. see
+    # https://github.com/litestar-org/litestar/issues/1191 and https://github.com/encode/uvicorn/issues/1045
 
-    console.rule("[yellow]Starting server process", align="left")
+    process_args = {
+        "reload": env.reload or reload,
+        "host": env.host or host,
+        "port": env.port or port,
+        "factory": env.is_app_factory,
+    }
 
-    uvicorn.run(
-        env.app_path,
-        reload=env.reload or reload,
-        host=env.host or host,
-        port=env.port or port,
-        factory=env.is_app_factory,
-    )
+    subprocess.run(["uvicorn", env.app_path, *_convert_uvicorn_args(process_args)], check=True)
 
 
 @command(name="routes")

{"golden_diff": "diff --git a/starlite/cli/commands/core.py b/starlite/cli/commands/core.py\n--- a/starlite/cli/commands/core.py\n+++ b/starlite/cli/commands/core.py\n@@ -1,4 +1,6 @@\n import inspect\n+import subprocess\n+from typing import Any, Dict, List\n \n from click import command, option\n from rich.tree import Tree\n@@ -8,6 +10,18 @@\n from starlite.utils.helpers import unwrap_partial\n \n \n+def _convert_uvicorn_args(args: Dict[str, Any]) -> List[str]:\n+    process_args = []\n+    for arg, value in args.items():\n+        if isinstance(value, bool):\n+            if value:\n+                process_args.append(f\"--{arg}\")\n+        else:\n+            process_args.append(f\"--{arg}={value}\")\n+\n+    return process_args\n+\n+\n @command(name=\"info\")\n def info_command(app: Starlite) -> None:\n     \"\"\"Show information about the detected Starlite app.\"\"\"\n@@ -38,24 +52,24 @@\n     \"\"\"\n \n     try:\n-        import uvicorn\n+        import uvicorn  # noqa: F401\n     except ImportError:\n         raise StarliteCLIException(\"Uvicorn needs to be installed to run an app\")  # pylint: disable=W0707\n \n     if debug or env.debug:\n         app.debug = True\n \n-    show_app_info(app)\n+    # invoke uvicorn in a subprocess to be able to use the --reload flag. see\n+    # https://github.com/litestar-org/litestar/issues/1191 and https://github.com/encode/uvicorn/issues/1045\n \n-    console.rule(\"[yellow]Starting server process\", align=\"left\")\n+    process_args = {\n+        \"reload\": env.reload or reload,\n+        \"host\": env.host or host,\n+        \"port\": env.port or port,\n+        \"factory\": env.is_app_factory,\n+    }\n \n-    uvicorn.run(\n-        env.app_path,\n-        reload=env.reload or reload,\n-        host=env.host or host,\n-        port=env.port or port,\n-        factory=env.is_app_factory,\n-    )\n+    subprocess.run([\"uvicorn\", env.app_path, *_convert_uvicorn_args(process_args)], check=True)\n \n \n @command(name=\"routes\")\n", "issue": "StaticFilesConfig and virtual directories\nI'm trying to write a ``FileSystemProtocol`` to load files from the package data using [importlib_resources](https://importlib-resources.readthedocs.io/en/latest/using.html#). But because ``directories`` is defined as ``DirectoryPath``, pydantic checks if the given directories exist in the local filesystem. \r\n\r\nThis is not generally true, especially in any kind of virtual filesystem (e.g. a zipped package). I think this condition should be relaxed to support virtual filesystems.\r\n\r\nhttps://github.com/starlite-api/starlite/blob/9bb6dcd57c10a591377cf8e3a537e9292566d5b9/starlite/config/static_files.py#L32\n", "before_files": [{"content": "import inspect\n\nfrom click import command, option\nfrom rich.tree import Tree\n\nfrom starlite import HTTPRoute, Starlite, WebSocketRoute\nfrom starlite.cli.utils import StarliteCLIException, StarliteEnv, console, show_app_info\nfrom starlite.utils.helpers import unwrap_partial\n\n\n@command(name=\"info\")\ndef info_command(app: Starlite) -> None:\n    \"\"\"Show information about the detected Starlite app.\"\"\"\n\n    show_app_info(app)\n\n\n@command(name=\"run\")\n@option(\"-r\", \"--reload\", help=\"Reload server on changes\", default=False, is_flag=True)\n@option(\"-p\", \"--port\", help=\"Serve under this port\", type=int, default=8000, show_default=True)\n@option(\"--host\", help=\"Server under this host\", default=\"127.0.0.1\", show_default=True)\n@option(\"--debug\", help=\"Run app in debug mode\", is_flag=True)\ndef run_command(\n    reload: bool,\n    port: int,\n    host: str,\n    debug: bool,\n    env: StarliteEnv,\n    app: Starlite,\n) -> None:\n    \"\"\"Run a Starlite app.\n\n    The app can be either passed as a module path in the form of <module name>.<submodule>:<app instance or factory>,\n    set as an environment variable STARLITE_APP with the same format or automatically discovered from one of these\n    canonical paths: app.py, asgi.py, application.py or app/__init__.py. When autodiscovering application factories,\n    functions with the name ``create_app`` are considered, or functions that are annotated as returning a ``Starlite``\n    instance.\n    \"\"\"\n\n    try:\n        import uvicorn\n    except ImportError:\n        raise StarliteCLIException(\"Uvicorn needs to be installed to run an app\")  # pylint: disable=W0707\n\n    if debug or env.debug:\n        app.debug = True\n\n    show_app_info(app)\n\n    console.rule(\"[yellow]Starting server process\", align=\"left\")\n\n    uvicorn.run(\n        env.app_path,\n        reload=env.reload or reload,\n        host=env.host or host,\n        port=env.port or port,\n        factory=env.is_app_factory,\n    )\n\n\n@command(name=\"routes\")\ndef routes_command(app: Starlite) -> None:  # pragma: no cover\n    \"\"\"Display information about the application's routes.\"\"\"\n\n    tree = Tree(\"\", hide_root=True)\n\n    for route in sorted(app.routes, key=lambda r: r.path):\n        if isinstance(route, HTTPRoute):\n            branch = tree.add(f\"[green]{route.path}[/green] (HTTP)\")\n            for handler in route.route_handlers:\n                handler_info = [\n                    f\"[blue]{handler.name or handler.handler_name}[/blue]\",\n                ]\n\n                if inspect.iscoroutinefunction(unwrap_partial(handler.fn.value)):\n                    handler_info.append(\"[magenta]async[/magenta]\")\n                else:\n                    handler_info.append(\"[yellow]sync[/yellow]\")\n\n                handler_info.append(f'[cyan]{\", \".join(sorted(handler.http_methods))}[/cyan]')\n\n                if len(handler.paths) > 1:\n                    for path in handler.paths:\n                        branch.add(\" \".join([f\"[green]{path}[green]\", *handler_info]))\n                else:\n                    branch.add(\" \".join(handler_info))\n\n        else:\n            if isinstance(route, WebSocketRoute):\n                route_type = \"WS\"\n            else:\n                route_type = \"ASGI\"\n            branch = tree.add(f\"[green]{route.path}[/green] ({route_type})\")\n            branch.add(f\"[blue]{route.route_handler.name or route.route_handler.handler_name}[/blue]\")\n\n    console.print(tree)\n", "path": "starlite/cli/commands/core.py"}], "after_files": [{"content": "import inspect\nimport subprocess\nfrom typing import Any, Dict, List\n\nfrom click import command, option\nfrom rich.tree import Tree\n\nfrom starlite import HTTPRoute, Starlite, WebSocketRoute\nfrom starlite.cli.utils import StarliteCLIException, StarliteEnv, console, show_app_info\nfrom starlite.utils.helpers import unwrap_partial\n\n\ndef _convert_uvicorn_args(args: Dict[str, Any]) -> List[str]:\n    process_args = []\n    for arg, value in args.items():\n        if isinstance(value, bool):\n            if value:\n                process_args.append(f\"--{arg}\")\n        else:\n            process_args.append(f\"--{arg}={value}\")\n\n    return process_args\n\n\n@command(name=\"info\")\ndef info_command(app: Starlite) -> None:\n    \"\"\"Show information about the detected Starlite app.\"\"\"\n\n    show_app_info(app)\n\n\n@command(name=\"run\")\n@option(\"-r\", \"--reload\", help=\"Reload server on changes\", default=False, is_flag=True)\n@option(\"-p\", \"--port\", help=\"Serve under this port\", type=int, default=8000, show_default=True)\n@option(\"--host\", help=\"Server under this host\", default=\"127.0.0.1\", show_default=True)\n@option(\"--debug\", help=\"Run app in debug mode\", is_flag=True)\ndef run_command(\n    reload: bool,\n    port: int,\n    host: str,\n    debug: bool,\n    env: StarliteEnv,\n    app: Starlite,\n) -> None:\n    \"\"\"Run a Starlite app.\n\n    The app can be either passed as a module path in the form of <module name>.<submodule>:<app instance or factory>,\n    set as an environment variable STARLITE_APP with the same format or automatically discovered from one of these\n    canonical paths: app.py, asgi.py, application.py or app/__init__.py. When autodiscovering application factories,\n    functions with the name ``create_app`` are considered, or functions that are annotated as returning a ``Starlite``\n    instance.\n    \"\"\"\n\n    try:\n        import uvicorn  # noqa: F401\n    except ImportError:\n        raise StarliteCLIException(\"Uvicorn needs to be installed to run an app\")  # pylint: disable=W0707\n\n    if debug or env.debug:\n        app.debug = True\n\n    # invoke uvicorn in a subprocess to be able to use the --reload flag. see\n    # https://github.com/litestar-org/litestar/issues/1191 and https://github.com/encode/uvicorn/issues/1045\n\n    process_args = {\n        \"reload\": env.reload or reload,\n        \"host\": env.host or host,\n        \"port\": env.port or port,\n        \"factory\": env.is_app_factory,\n    }\n\n    subprocess.run([\"uvicorn\", env.app_path, *_convert_uvicorn_args(process_args)], check=True)\n\n\n@command(name=\"routes\")\ndef routes_command(app: Starlite) -> None:  # pragma: no cover\n    \"\"\"Display information about the application's routes.\"\"\"\n\n    tree = Tree(\"\", hide_root=True)\n\n    for route in sorted(app.routes, key=lambda r: r.path):\n        if isinstance(route, HTTPRoute):\n            branch = tree.add(f\"[green]{route.path}[/green] (HTTP)\")\n            for handler in route.route_handlers:\n                handler_info = [\n                    f\"[blue]{handler.name or handler.handler_name}[/blue]\",\n                ]\n\n                if inspect.iscoroutinefunction(unwrap_partial(handler.fn.value)):\n                    handler_info.append(\"[magenta]async[/magenta]\")\n                else:\n                    handler_info.append(\"[yellow]sync[/yellow]\")\n\n                handler_info.append(f'[cyan]{\", \".join(sorted(handler.http_methods))}[/cyan]')\n\n                if len(handler.paths) > 1:\n                    for path in handler.paths:\n                        branch.add(\" \".join([f\"[green]{path}[green]\", *handler_info]))\n                else:\n                    branch.add(\" \".join(handler_info))\n\n        else:\n            if isinstance(route, WebSocketRoute):\n                route_type = \"WS\"\n            else:\n                route_type = \"ASGI\"\n            branch = tree.add(f\"[green]{route.path}[/green] ({route_type})\")\n            branch.add(f\"[blue]{route.route_handler.name or route.route_handler.handler_name}[/blue]\")\n\n    console.print(tree)\n", "path": "starlite/cli/commands/core.py"}]}