Skip to content

Installing python and Django on Windows

23/12/2015

Some notes on installing python amd Django on a Windows system.

1) download Anaconda3 (2.4.1)
http://www.continuum.io/downloads
* creates full phyton 3.5 environment with data analysis packages

2) check if django is installed
C:\Users\john.knight>python -c “import django; print(django.get_version())”
Traceback (most recent call last):
File “<string>”, line 1, in <module>
ImportError: No module named django

3) check the python directory
C:\Users\john.knight>where python
C:\Anaconda3\python.exe

C:\Users\john.knight>cd C:\Anaconda3\Scripts
C:\Anaconda3\Scripts\pip install django
Collecting django
Downloading Django-1.9-py2.py3-none-any.whl (6.6MB)
100% |################################| 6.6MB 64kB/s
Installing collected packages: django
Successfully installed django-1.9

4) check the version
C:\Users\john.knight>python -c “import django; print(django.get_version())”
1.9

5) browse the Django tutorial for versin 1.9: https://docs.djangoproject.com/en/1.9/intro/tutorial01/

6) create the Django project
navigate to where the code should be stored
c:\Anaconda3>cd C:\Users\john.knight\OneDrive\Django

C:\Users\john.knight\OneDrive\Django>django-admin startproject mysite

This creates a folder called mysite with some contents.
\mysite
manage.py
\mysite
__init__.py
settings.py
urls.py
wsgi.py

7) Verify that Django site works
navigate to outermost mysite container
C:\Users\john.knight\OneDrive\Django\mysite>python manage.py runserver
Performing system checks…

System check identified no issues (0 silenced).

You have unapplied migrations; your app may not work properly until they are app
lied.
Run ‘python manage.py migrate’ to apply them.
December 23, 2015 – 16:04:30
Django version 1.9, using settings ‘mysite.settings’
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

The warning about unapplied migrations can be ignored.
This has now started up a lightweight web server to test the Django site. The official diocumentation warns not to use this webs erver as production, only as development.

Browse to http://127.0.0.1:8000/ and you should see the site, albeit very sparse at this point in time.

View the Django documentation to see how to change the port and/or IP address used by the development web server.

Further post will step through creation of a Django application.

Advertisements

From → Development

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: