6

PHP Laravel Developer who wants to learn Python quickly? You have to look at Mas...

 3 years ago
source link: https://dev.to/rickavmaniac/php-laravel-developer-who-wants-to-learn-python-quickly-you-have-to-look-at-masonite-3jh9
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Cover image for PHP Laravel Developer who wants to learn Python quickly? You have to look at Masonite.

PHP Laravel Developer who wants to learn Python quickly? You have to look at Masonite.

Jan 18

・1 min read

If you are familiar with PHP and Laravel and would like to learn Python, it is good to know that there is a Python web framework out there that is very similar to Laravel: Masonite.

Masonite is a Python MVC web framework which is very close to Laravel. So in a few hours you will be able to develop your own Python web application :-)

Here is the documentation and the starting instructions: https://docs.masoniteproject.com/

There are also some getting started videos: https://masonitecasts.com/timeline/getting-started/introduction

Here are some examples of Python Masonite.

Routing


ROUTES = [
    Get('/contacts', 'ContactsController@index').name('contacts.index'),
    Post('/contacts', 'ContactsController@store').name('contacts.store'),

]
Enter fullscreen modeExit fullscreen mode

Controller

def index(self, view: View, request: Request):
    contacts = Contact.all()
    return view.render('contacts.index', {'contacts': contacts})

Enter fullscreen modeExit fullscreen mode

Migrations

def up(self):
    with self.schema.create('Contacts') as table:
        table.increments('id')
        table.string('last_name')
        table.string('first_name')
        table.timestamps()

Enter fullscreen modeExit fullscreen mode

As you can see your Laravel knowledge will be very useful :-)

If you have any questions do not hesitate.

For those who like the concept and want to encourage the developer please don’t hesitate to give a little star for Masonite on Github: https://github.com/MasoniteFramework/masonite

Good development!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK