Features: 1) Add static files configuration in nginx for cross-origin requests.
Fixes: 1) Update Console styling in 'initialize' command to remove non-standard style notice; 2) Simplify STATIC_URL and MEDIA_URL definitions in settings for uniformity. Extra: 1) Minor cleanup in static and media path handling; 2) Add new location block in nginx for static files access.
This commit is contained in:
parent
dd2922e3e6
commit
cd067ee5da
3 changed files with 8 additions and 11 deletions
|
|
@ -12,7 +12,7 @@ logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
def handle(self, *args: list[Any], **options: dict[Any, Any]) -> None:
|
def handle(self, *args: list[Any], **options: dict[Any, Any]) -> None:
|
||||||
self.stdout.write(self.style.NOTICE("Initializing must-have instances..."))
|
self.stdout.write("Initializing must-have instances...")
|
||||||
|
|
||||||
Vendor.objects.get_or_create(name="INNER")
|
Vendor.objects.get_or_create(name="INNER")
|
||||||
Group.objects.all()
|
Group.objects.all()
|
||||||
|
|
|
||||||
|
|
@ -292,18 +292,10 @@ DEFAULT_AUTO_FIELD: str = "django.db.models.BigAutoField"
|
||||||
|
|
||||||
TIME_ZONE: str = getenv("TIME_ZONE", "Europe/London")
|
TIME_ZONE: str = getenv("TIME_ZONE", "Europe/London")
|
||||||
|
|
||||||
STATIC_URL: str = (
|
STATIC_URL: str = "/static/"
|
||||||
f"http://api.{getenv('EVIBES_BASE_DOMAIN')}/static/"
|
|
||||||
if DEBUG
|
|
||||||
else f"https://api.{getenv('EVIBES_BASE_DOMAIN')}/static/"
|
|
||||||
)
|
|
||||||
STATIC_ROOT: Path = BASE_DIR / "static"
|
STATIC_ROOT: Path = BASE_DIR / "static"
|
||||||
|
|
||||||
MEDIA_URL: str = (
|
MEDIA_URL: str = "/media/"
|
||||||
f"http://api.{getenv('EVIBES_BASE_DOMAIN')}/media/"
|
|
||||||
if DEBUG
|
|
||||||
else f"https://api.{getenv('EVIBES_BASE_DOMAIN')}/media/"
|
|
||||||
)
|
|
||||||
MEDIA_ROOT: Path = BASE_DIR / "media"
|
MEDIA_ROOT: Path = BASE_DIR / "media"
|
||||||
|
|
||||||
AUTH_USER_MODEL: str = "vibes_auth.User"
|
AUTH_USER_MODEL: str = "vibes_auth.User"
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,11 @@ server {
|
||||||
default_type text/plain;
|
default_type text/plain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location /static/ {
|
||||||
|
add_header Access-Control-Allow-Origin "*";
|
||||||
|
root /var/jenkins/workspace/evibes;
|
||||||
|
}
|
||||||
|
|
||||||
location /favicon.ico {
|
location /favicon.ico {
|
||||||
add_header Access-Control-Allow-Origin "*";
|
add_header Access-Control-Allow-Origin "*";
|
||||||
root /var/jenkins/workspace/evibes/static;
|
root /var/jenkins/workspace/evibes/static;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue