Skip to content

Commit

Permalink
Set default example.com dev site to pythondiscord.local:8000
Browse files Browse the repository at this point in the history
  • Loading branch information
scragly committed Oct 19, 2019
1 parent 60807c7 commit 6ab05d3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,19 @@ def wait_for_postgres() -> None:
print("Database could not be found, exiting.")
sys.exit(1)

@staticmethod
def set_dev_site_name() -> None:
"""Set the development site domain in admin from default example."""
# import Site model now after django setup
from django.contrib.sites.models import Site
query = Site.objects.filter(id=1)
site = query.get()
if site.domain == "example.com":
query.update(
domain="pythondiscord.local:8000",
name="pythondiscord.local:8000"
)

def prepare_server(self) -> None:
"""Perform preparation tasks before running the server."""
django.setup()
Expand All @@ -125,6 +138,7 @@ def prepare_server(self) -> None:
call_command("collectstatic", interactive=False, clear=True, verbosity=self.verbosity)

if self.debug:
self.set_dev_site_name()
self.create_superuser()

def run_server(self) -> None:
Expand Down

0 comments on commit 6ab05d3

Please sign in to comment.