This document has been moved to https://selenium-python.readthedocs.org
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ====================================== | |
| Setting up Nginx, uWSGI and Python3 | |
| ====================================== | |
| First off, I'm traditionally a PHP developer, but am looking at moving across to Python. I really struggled to find decent documentation on how to get a server up and running for deploying Python web applications from the point of view of someone coming from PHP. The main problems I came across with documentation were: | |
| 1) Only showed you how to run the server for a single web application. | |
| 2) Only showed you how to configure the app, not the server it was running on. | |
| My preferred workflow for development is by setting up a new VM in VMware Fusion and then forwarding through all requests to that VM via /etc/hosts. This might not be the optimal way to get things up and running, but it works for me. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -module(fileop). | |
| -export([write_file/3]). | |
| -compile({parse_transform,do}). | |
| %% Uses an error monad to neatly compose a bunch of failing functions. | |
| %% | |
| %% Everything being composed returns ok|{ok,Result}|{error,Reason}. At | |
| %% the first error, the reason term is returned. The monad factors out | |
| %% the behaviour of piping all possible errors to the output (via a | |
| %% try-throw or case tree) if they occur. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyInline(admin.TabularInline): | |
| model = MyModel | |
| extra = 0 | |
| template = 'admin/edit_inline/list.html' | |
| def get_formset(self, request, obj=None, **kwargs): | |
| FormSet = super(ActivationKeyInline, self).get_formset(request, obj, **kwargs) | |
| class NewFormSet(FormSet): | |
| def _construct_forms(self, *args, **kwargs): | |
| qs = self.get_queryset() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # If you work with git, you've probably had that nagging sensation of not knowing what branch you are on. Worry no longer! | |
| export PS1="\\w:\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)\$ " | |
| # This will change your prompt to display not only your working directory but also your current git branch, if you have one. Pretty nifty! | |
| # ~/code/web:beta_directory$ git checkout master | |
| # Switched to branch "master" | |
| # ~/code/web:master$ git checkout beta_directory | |
| # Switched to branch "beta_directory" |
NewerOlder