Skip to content

Latest commit

 

History

History
54 lines (42 loc) · 3.14 KB

WindowsVS.md

File metadata and controls

54 lines (42 loc) · 3.14 KB

Web App Development

Windows – Python Tools for Visual Studio

  • Clone the repository.
    First, clone the repository using the URL provided on development section.
    Open the solution file (.sln) that is included in the root of the repository.
    7

  • Change the requirements file.
    Double-click on requirements.txt. If you’re using a PostgreSQL database, add psycopg2==2.6.2.
    If you’re using a MySQL database, add mysqlclient==1.3.7. By default, requirements.txt contains the driver for a PostgreSQL database.
    8

  • Create a virtual environment.
    Right-click on Python Environments and select Add Virtual Environment. Make sure the name is env. Click Create, this will create the virtual environment and the dependencies listed in requirenments.txt.
    9

  • Change the information on the database.
    Open the folder MsBlog and double-click on settings.py.
    10
    Scroll down until you find the DATABASES. Change the information according to your database. Save.
    Engine for PostgreSQL: 'django.db.backends.postgresql_psycopg2'
    Engine for MySQL: 'django.db.backends.mysql'
    11

  • Migrate and create a superuser.
    To migrate the information into the new database, right-click on the root project, select python and click-on migrate.
    12
    Now, create the super user. As before, right-click on the root project, select python and select Create Superuser. 13
    Django will prompt a command-line to set the superuser. Follow the instructions.

+Collect static files.
To collect the static files, right-click on the root project, select python and click-on Collect Static Files. 20

  • Run using developer server.
    Press F5 to start debugging, and your web browser will open automatically to the page running locally.
    14

  • Make changes.
    Now you can experiment by making changes to the application sources and/or templates.
    To access the admin page to add users, or add new posts, access through /admin/.
    15
    Once you have logged in, you can either add posts through the admins page or in the website as /posts/create/.
    16
    17
    After you’ve tested your changes, commit to the Git repository.

  • Deploy to Azure.
    If you need help with git, please refer to [Local Git Deployment to Azure App Service] (https://github.com/Azure/azure-content/blob/master/articles/app-service-web/app-service-deploy-local-git.md).