Skip to content

Commit

Permalink
Merge pull request #1103 from zooba/issue-1101
Browse files Browse the repository at this point in the history
Issue 1101
  • Loading branch information
zooba committed Feb 26, 2016
2 parents 1c2c892 + 293127a commit 2fc7280
Show file tree
Hide file tree
Showing 8 changed files with 553 additions and 320 deletions.
54 changes: 53 additions & 1 deletion Python/Product/Django/Microsoft.PythonTools.Django.targets
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,17 @@
-->

<PropertyGroup>
<PythonCommands>DjangoShellCommand;DjangoValidateAppCommand;DjangoMigrateCommand;DjangoCollectStaticCommand;DjangoSyncDbCommand;$(PythonCommands)</PythonCommands>
<PythonCommands>
DjangoShellCommand;
DjangoCheckCommand;
DjangoMakeMigrationsCommand;
DjangoMigrateCommand;
DjangoCreateSuperUserCommand;
DjangoCollectStaticCommand;
$(PythonCommands);
DjangoValidateAppCommand;
DjangoSyncDbCommand;
</PythonCommands>

<StartupPathOrManagePy>$(QualifiedProjectHome)manage.py</StartupPathOrManagePy>
<StartupPathOrManagePy Condition="Exists($(StartupPath))">$(StartupPath)</StartupPathOrManagePy>
Expand All @@ -190,6 +200,20 @@
</CreatePythonCommandItem>
</Target>

<Target Name="DjangoCheckCommand"
Label="resource:Microsoft.PythonTools.Django;Microsoft.PythonTools.Django.Resources;CheckLabel"
DependsOnTargets="SetStartupPathOrManagePy"
Returns="@(Commands)">
<CreatePythonCommandItem Target="$(StartupPathOrManagePy)"
TargetType="script"
Arguments="check"
WorkingDirectory="$(WorkingDirectory)"
Environment="DJANGO_SETTINGS_MODULE=$(DjangoSettingsModule)"
ExecuteIn="Repl:resource:Microsoft.PythonTools.Django;Microsoft.PythonTools.Django.Resources;CommandReplTitle">
<Output TaskParameter="Command" ItemName="Commands" />
</CreatePythonCommandItem>
</Target>

<Target Name="DjangoValidateAppCommand"
Label="resource:Microsoft.PythonTools.Django;Microsoft.PythonTools.Django.Resources;ValidateAppLabel"
DependsOnTargets="SetStartupPathOrManagePy"
Expand All @@ -204,6 +228,20 @@
</CreatePythonCommandItem>
</Target>

<Target Name="DjangoMakeMigrationsCommand"
Label="resource:Microsoft.PythonTools.Django;Microsoft.PythonTools.Django.Resources;MakeMigrationsLabel"
DependsOnTargets="SetStartupPathOrManagePy"
Returns="@(Commands)">
<CreatePythonCommandItem Target="$(StartupPathOrManagePy)"
TargetType="script"
Arguments="makemigrations"
WorkingDirectory="$(WorkingDirectory)"
Environment="DJANGO_SETTINGS_MODULE=$(DjangoSettingsModule)"
ExecuteIn="Repl:resource:Microsoft.PythonTools.Django;Microsoft.PythonTools.Django.Resources;CommandReplTitle">
<Output TaskParameter="Command" ItemName="Commands" />
</CreatePythonCommandItem>
</Target>

<Target Name="DjangoMigrateCommand"
Label="resource:Microsoft.PythonTools.Django;Microsoft.PythonTools.Django.Resources;MigrateLabel"
DependsOnTargets="SetStartupPathOrManagePy"
Expand All @@ -218,6 +256,20 @@
</CreatePythonCommandItem>
</Target>

<Target Name="DjangoCreateSuperUserCommand"
Label="resource:Microsoft.PythonTools.Django;Microsoft.PythonTools.Django.Resources;CreateSuperUserLabel"
DependsOnTargets="SetStartupPathOrManagePy"
Returns="@(Commands)">
<CreatePythonCommandItem Target="$(StartupPathOrManagePy)"
TargetType="script"
Arguments="createsuperuser"
WorkingDirectory="$(WorkingDirectory)"
Environment="DJANGO_SETTINGS_MODULE=$(DjangoSettingsModule)"
ExecuteIn="Repl:resource:Microsoft.PythonTools.Django;Microsoft.PythonTools.Django.Resources;CommandReplTitle">
<Output TaskParameter="Command" ItemName="Commands" />
</CreatePythonCommandItem>
</Target>

<Target Name="DjangoSyncDbCommand"
Label="resource:Microsoft.PythonTools.Django;Microsoft.PythonTools.Django.Resources;SyncDbLabel"
DependsOnTargets="SetStartupPathOrManagePy"
Expand Down
33 changes: 30 additions & 3 deletions Python/Product/Django/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions Python/Product/Django/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,18 @@
<data name="AddWebRoleSupportFiles" xml:space="preserve">
<value>To ensure your project will deploy correctly to Microsoft Azure Cloud Service, add the Web Role Support Files item to your project through the Add New Item dialog and follow the instructions provided.</value>
</data>
<data name="CheckLabel" xml:space="preserve">
<value>Django C&amp;heck (Django &gt;= 1.7)</value>
</data>
<data name="CollectStaticLabel" xml:space="preserve">
<value>&amp;Collect Static Files</value>
</data>
<data name="CommandReplTitle" xml:space="preserve">
<value>Django Management Console - {ProjectName}</value>
</data>
<data name="CreateSuperUserLabel" xml:space="preserve">
<value>Django Create S&amp;uperuser (Django &gt;= 1.7)</value>
</data>
<data name="DjangoAppAlreadyExistsCreateAnyway" xml:space="preserve">
<value>C&amp;reate anyway</value>
</data>
Expand All @@ -150,8 +156,11 @@
<data name="DjangoSettingsModuleHelp" xml:space="preserve">
<value>The Python path to a settings module, e.g. "myproject.settings.main". If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used.</value>
</data>
<data name="MakeMigrationsLabel" xml:space="preserve">
<value>Django Ma&amp;ke Migrations (Django &gt;= 1.7)</value>
</data>
<data name="MigrateLabel" xml:space="preserve">
<value>Django &amp;Migrate... (Django 1.7 and later)</value>
<value>Django &amp;Migrate... (Django &gt;= 1.7)</value>
</data>
<data name="OpenDjangoShellLabel" xml:space="preserve">
<value>Open &amp;Django Shell</value>
Expand All @@ -168,9 +177,9 @@ The web.config file will be configured to resolve URIs matching this pattern to
NOTE: This pattern is applied in addition to the static URI specified in the Django settings module.</value>
</data>
<data name="SyncDbLabel" xml:space="preserve">
<value>Django &amp;Sync DB... (Django 1.6 and earlier)</value>
<value>Django &amp;Sync DB... (Django &lt;= 1.6)</value>
</data>
<data name="ValidateAppLabel" xml:space="preserve">
<value>&amp;Validate Django App...</value>
<value>&amp;Validate Django App... (Django &lt;= 1.6)</value>
</data>
</root>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,25 @@
<body>
<h1 class="top">One more thing...</h1>
<p>
Before running this project, you may want to create a super user by <strong>synchronizing the
database</strong>.
Before running this project, you may want to <strong>create a super user</strong>.
</p>


<h1>Synchronize the Database</h1>
<p>
This project has default settings for the database (it uses sqlite).
If you need a super user, you'll need to sync the database before running the project.
If you need a super user, you'll need to create one before running the project.
</p>

<ol>
<li>Open Solution Explorer.</li>
<li>
<p>Right-click the project node and select Python->Django Sync DB.</p>
<p>Right-click the project node and select Python->Django Create Superuser.</p>
<img src="SyncDB.png" />
</li>
<li>You will be prompted to create a super user, enter yes.</li>
<li>
Enter a user name, email and password when prompted. The username
and password do not need to match any existing account.
Enter account details when prompted. This creates a new account, and
the details do not need to match any of your existing accounts.
</li>
</ol>
</body>
Expand Down

0 comments on commit 2fc7280

Please sign in to comment.