plain.dev 0.8.3__py3-none-any.whl → 0.10.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
plain/dev/cli.py CHANGED
@@ -78,41 +78,24 @@ class Dev:
78
78
  self.custom_process_env = {
79
79
  **self.plain_env,
80
80
  "PORT": str(self.port),
81
- "PYTHONPATH": os.path.join(APP_PATH.parent, "app"),
82
81
  }
83
82
  self.project_name = os.path.basename(os.getcwd())
83
+ self.domain = f"{self.project_name}.localhost"
84
84
  self.ssl_cert_path = None
85
85
  self.ssl_key_path = None
86
86
 
87
- self.is_codespace = "CODESPACES" in os.environ
88
-
89
- if self.is_codespace:
90
- codespace_name = os.environ["CODESPACE_NAME"]
91
- codespace_forward_domain = os.environ[
92
- "GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN"
93
- ]
94
- self.domain = f"{codespace_name}-{self.port}.{codespace_forward_domain}"
95
- self.url = f"https://{self.domain}/"
96
- self.gunicorn_bind = f"127.0.0.1:{self.port}"
97
- else:
98
- self.domain = f"{self.project_name}.localhost"
99
- self.url = f"https://{self.domain}:{self.port}/"
100
- self.gunicorn_bind = f"{self.domain}:{self.port}"
101
-
102
87
  def run(self):
103
88
  pid = Pid()
104
89
  pid.write()
105
90
 
106
91
  try:
107
- if not self.is_codespace:
108
- mkcert_manager = MkcertManager()
109
- mkcert_manager.setup_mkcert(install_path=Path.home() / ".plain" / "dev")
110
- self.ssl_cert_path, self.ssl_key_path = mkcert_manager.generate_certs(
111
- domain=self.domain,
112
- storage_path=Path(settings.PLAIN_TEMP_PATH) / "dev" / "certs",
113
- )
114
- self.modify_hosts_file()
115
-
92
+ mkcert_manager = MkcertManager()
93
+ mkcert_manager.setup_mkcert(install_path=Path.home() / ".plain" / "dev")
94
+ self.ssl_cert_path, self.ssl_key_path = mkcert_manager.generate_certs(
95
+ domain=self.domain,
96
+ storage_path=Path(settings.PLAIN_TEMP_PATH) / "dev" / "certs",
97
+ )
98
+ self.modify_hosts_file()
116
99
  self.set_csrf_and_allowed_hosts()
117
100
  self.run_preflight()
118
101
 
@@ -123,8 +106,9 @@ class Dev:
123
106
  self.add_services()
124
107
 
125
108
  # Output the clickable link before starting the manager loop
109
+ url = f"https://{self.domain}:{self.port}/"
126
110
  click.secho(
127
- f"\nYour app will run at: {click.style(self.url, fg='green', underline=True)}\n",
111
+ f"\nYour app will run at: {click.style(url, fg='green', underline=True)}\n",
128
112
  bold=True,
129
113
  )
130
114
 
@@ -230,7 +214,11 @@ class Dev:
230
214
  gunicorn_cmd = [
231
215
  "gunicorn",
232
216
  "--bind",
233
- self.gunicorn_bind,
217
+ f"{self.domain}:{self.port}",
218
+ "--certfile",
219
+ str(self.ssl_cert_path),
220
+ "--keyfile",
221
+ str(self.ssl_key_path),
234
222
  "--reload",
235
223
  "plain.wsgi:app",
236
224
  "--timeout",
@@ -245,15 +233,6 @@ class Dev:
245
233
  "--log-config-json",
246
234
  str(Path(__file__).parent / "gunicorn_logging.json"),
247
235
  ]
248
-
249
- if self.ssl_cert_path and self.ssl_key_path:
250
- gunicorn_cmd += [
251
- "--certfile",
252
- str(self.ssl_cert_path),
253
- "--keyfile",
254
- str(self.ssl_key_path),
255
- ]
256
-
257
236
  gunicorn = " ".join(gunicorn_cmd)
258
237
 
259
238
  if plain_db_installed:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: plain.dev
3
- Version: 0.8.3
3
+ Version: 0.10.0
4
4
  Summary: Local development tools for Plain.
5
5
  Home-page: https://plainframework.com
6
6
  License: BSD-3-Clause
@@ -1,6 +1,6 @@
1
1
  plain/dev/README.md,sha256=BQDaRKfsafIPzx7vtVt-zS-a8l6sxbQThhQTvu7tp3Y,3699
2
2
  plain/dev/__init__.py,sha256=C1JrkNE5XX2DLgBXXLAV_UyhofwVd0ZPL59fPUMbOKo,139
3
- plain/dev/cli.py,sha256=nvECmkvouPgqG3OzUPVGaVSB4CuidkzHexpRZg46Ucg,10039
3
+ plain/dev/cli.py,sha256=ID6Y6VgO8cFlDg-8mR-pdgo3bt14MsN24UYHB1iPsQ8,9252
4
4
  plain/dev/config.py,sha256=h6o5YZtJhg-cFIWoqIDWuMCC5T09cxEsBaa3BP4Nii0,632
5
5
  plain/dev/contribute/__init__.py,sha256=9ByBOIdM8DebChjNz-RH2atdz4vWe8somlwNEsbhwh4,40
6
6
  plain/dev/contribute/cli.py,sha256=qZ7YmE_upbw-Y5NRpvaHnJTPp9kvn21fPQ7G0n1LAkg,2277
@@ -26,8 +26,8 @@ plain/dev/templates/dev/requests.html,sha256=kQKJZq5L77juuL_t8UjcAehEU61U4RXNnKa
26
26
  plain/dev/urls.py,sha256=b4NL2I6Ok-t7nTPjRnKoz_LQRttE3_mp8l2NlmeYQ9I,146
27
27
  plain/dev/utils.py,sha256=4wMzpvj1Is_c0QxhsTu34_P9wAYlzw4glNPfVtZr_0A,123
28
28
  plain/dev/views.py,sha256=r2Ivk7OXytpRhXq4DZpsb7FXNP9vzmEE3D5kLajYG4w,1073
29
- plain_dev-0.8.3.dist-info/LICENSE,sha256=YDg-l_Rj7LVP5uDXy04eQPGb_DYVXAHAHYd9r3pU1Cg,2713
30
- plain_dev-0.8.3.dist-info/METADATA,sha256=OGPfO6dq0msdrTj2UL15OeKP89G_mSAn3PiC_fjkA14,4675
31
- plain_dev-0.8.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
32
- plain_dev-0.8.3.dist-info/entry_points.txt,sha256=rBo-S4THn07f55UwHBuUhIbDhlUq3EzTOD8mIb5fGQg,99
33
- plain_dev-0.8.3.dist-info/RECORD,,
29
+ plain_dev-0.10.0.dist-info/LICENSE,sha256=YDg-l_Rj7LVP5uDXy04eQPGb_DYVXAHAHYd9r3pU1Cg,2713
30
+ plain_dev-0.10.0.dist-info/METADATA,sha256=TgnvQbthTpizmpPf_gSladqZoSwLuA7mjv3gKQgGH44,4676
31
+ plain_dev-0.10.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
32
+ plain_dev-0.10.0.dist-info/entry_points.txt,sha256=rBo-S4THn07f55UwHBuUhIbDhlUq3EzTOD8mIb5fGQg,99
33
+ plain_dev-0.10.0.dist-info/RECORD,,