Opened 62 minutes ago
#37462 assigned Cleanup/optimization
Add Execution Policy guidance for PowerShell users
| Reported by: | Jonathan Biemond | Owned by: | sibling ticket contributors |
|---|---|---|---|
| Component: | Documentation | Version: | 6.1 |
| Severity: | Normal | Keywords: | docs windows tutorial powershell |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
Proposal to add instructions on how to set the execution policy for PowerShell users in the Install Django on Windows and Writing your first contribution pages.
Presently, the docs include commands for Windows users to activate the virtual environment in the Installing Django on Windows and the Writing your first contribution tutorials. Ticket #37452 generalizes the activation command to work for both Command Prompt and PowerShell users.
PowerShell users may have to set the execution policy before they can run the virtual environment activation script.
...\.venv\Scripts\Activate.ps1 cannot be loaded because running scripts is
disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\Scripts\activate
+ ~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
To simplify the experience for new Django users and contributors, the docs should include instructions with a command to set the execution policy.
There are various options for the level of execution policy to set, and has been discussed in the forum. https://forum.djangoproject.com/t/virtual-environment-on-windows/8445
The Python docs, in their virtual environment tutorial, recommend the following:
https://docs.python.org/3/library/venv.html?#creating-virtual-environments
PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser