Skip to content

Commit

Permalink
[Python] Update masonite to 3.0 (#3847)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhavmule authored Jan 25, 2021
1 parent 9127b0a commit a58ae5c
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 248 deletions.
5 changes: 3 additions & 2 deletions python/masonite/app/http/controllers/PageController.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from masonite.request import Request
from masonite.controllers import Controller


class PageController:
def index(self, request: Request):
class PageController(Controller):
def index(self):
return ""

def show_user(self, request: Request):
Expand Down
59 changes: 0 additions & 59 deletions python/masonite/bootstrap/start.py

This file was deleted.

2 changes: 1 addition & 1 deletion python/masonite/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
framework:
website: masoniteproject.com
version: 2.3
version: 3.0

build_deps:
- libffi-dev
Expand Down
8 changes: 5 additions & 3 deletions python/masonite/config/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
any other location as required by the application or its packages.
"""

NAME = env("APP_NAME", "Masonite 2.1")
NAME = env("APP_NAME", "Masonite 3.0")

"""Application Debug Mode
When your application is in debug mode, detailed error messages with
Expand All @@ -33,7 +33,7 @@
Sets the root URL of the application. This is primarily used for testing
"""

URL = "http://localhost:8000"
URL = env("APP_URL", "http://localhost:8000")

"""Base Directory
Sets the root path of your project
Expand All @@ -53,4 +53,6 @@
them in but feel free to autoload any directories
"""

AUTOLOAD = ["app"]
AUTOLOAD = [
"app",
]
66 changes: 0 additions & 66 deletions python/masonite/config/database.py

This file was deleted.

18 changes: 0 additions & 18 deletions python/masonite/config/packages.py

This file was deleted.

80 changes: 0 additions & 80 deletions python/masonite/config/storage.py

This file was deleted.

2 changes: 1 addition & 1 deletion python/masonite/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
masonite>=2.3.1,<2.4.0
masonite>=3.0.0,<3.1.0
gunicorn
meinheld
33 changes: 15 additions & 18 deletions python/masonite/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
# Disable all logging features
import logging

logging.disable()
"""First Entry For The WSGI Server."""

from masonite.environment import LoadEnvironment

"""First Entry For The WSGI Server."""
LoadEnvironment()

from masonite.app import App

from bootstrap.start import app
from config import providers
from masonite.helpers import config
from masonite.wsgi import response_handler

"""Instantiate Container And Perform Important Bindings
Some Service providers need important bindings like the WSGI application
and the application configuration file before they boot.
"""

container = App(remember=True)
container = App()

container.bind("WSGI", app)
container.bind("Container", container)
container.bind('WSGI', response_handler)
container.bind('Container', container)

container.bind("Providers", [])
container.bind("WSGIProviders", [])
container.bind('Providers', [])
container.bind('WSGIProviders', [])

"""Bind all service providers
Let's register everything into the Service Container. Once everything is
Expand All @@ -32,15 +29,15 @@
once if the wsgi attribute on a provider is False.
"""

for provider in providers.PROVIDERS:
for provider in config('providers.providers'):
located_provider = provider()
located_provider.load_app(container).register()
if located_provider.wsgi:
container.make("WSGIProviders").append(located_provider)
container.make('WSGIProviders').append(located_provider)
else:
container.make("Providers").append(located_provider)
container.make('Providers').append(located_provider)

for provider in container.make("Providers"):
for provider in container.make('Providers'):
container.resolve(provider.boot)

"""Get the application from the container
Expand All @@ -50,4 +47,4 @@
will allow WSGI servers to pick it up from the command line
"""

application = container.make("WSGI")
application = container.make('WSGI')

0 comments on commit a58ae5c

Please sign in to comment.