Setting up Django on IIS - python

I have been trying to setup Django to work on IIS 7 Enterprise (Version 6.1 on Windows 7), but so far have been unable to. I am using Django 1.8.3 and Python 2.7. I am using PyISAPI to run Django on IIS. I have tried both the 2.6 version of PyISAPI and the 2.7 version (http://blog.wolfplusplus.com/?attachment_id=276). I have followed the following tutorials:
IIS Not Linking to Django with PyISAPIe
http://blog.wolfplusplus.com/?p=272
I have followed others also, and all of them do slightly different things. None of them have worked with me so far, and all of the tutorials seems to be a couple of years old. Can someone provide a straightforward up to date guide on how to setup Django 1.8 (running with Python 2.7) with IIS. There seems to be multiple approaches such as using FastCGI, but I have read that PyISAPI is much faster than FastCGI. My goal is to run a Django application on IIS.

I've just followed that guide with following corrections:
You should give permission on the site folder to App Pool's identity. I just went to App Pool's Advanced Settings > Process model > Identity and set it to local admin account for testing purposes.
Correct environment variable name in step 4.13 is DJANGO_SETTINGS_MODULE, underscores were eaten by markup
and everything worked fine! If it's not applicable in your case please provide some additional details.

Related

In Django which version is now stable in 2019?

I was using django 1.1 and python2.7 in my project.
Now I will setup a new Django project from scratch. So i want to know if the above configuration is correct for my new project or I should use python3 and latest django version. If so then which Django,Python version will be good for new project? And I should get good support from django community.
Thanks
Currently, the last stable version of Django is 2.1.7. This version works with Python 3.7. You'll find a lot of support for this version of Django... there are a lot of develops about this version, such as Django Rest Framework, JWT, among others.
I suggest you for a project from scratch, work with Django 2.1.7 and Python 3.7, probably, you'll get quickly your goals. If you need to update your knowledge, you can do a course on a web platform as Udemy.
Soon Django 2.2 will be released... but I suppose we have to wait some days to get all benefits of this new release.

Deploying Django project on Linux

Comming from PHP(without frameworks), I don't quite understand how deploying works in Python. I have completed my simple Django version: (1, 10, 1, 'final', 1) blog project and all I have to do is put it online. I am using linux openSUSE distro and virtualenv
I have access to a mysql database with phpmyadmin and I have some space, accessed with filezilla. hosting site: https://host.bg/
But then I started researching of how to deploy my project and I stumbled upon stuf like apache, Nginx, wsgi and other stuff I haven't used in the project and not quite familiar how they work.
So my question is: Can I make my project into a folder with some files in it, copy->paste them in filezilla and have a working site and if not, how does django deployment really work and what should I do from here ?!
I would recommend you to use Git instead of FTP protocol. As you are using Linux you can easily connect to your SO using ssh.
About the deployment, I would recommend you to use GUnicorn for a WSGI way.
It's not hard to deploy with, but if you get in trouble you can use the official Django documentation for deploying Django with WSGI:
Link
Ps.: As you are using Linux, I would recommend to you to use VirtualEnv to allow you server many Django sites in the same Linux instance with the isolated environments
Check what version of Python is installed on the server hosting your account and if there's option for ssh access.
Host.bg and Bulgarian hosting providers in general fail to keep up with most things other than php and mysql. With shared plans they avoid installing anything new too.
I'd say contact support and see if they would be able to assist you with Apache configurations and whatever else is needed for your project.

How to create a sample django project?

This doesn't work for me.
$ python django-admin.py startproject myproject
I am running a ubuntu virtual m/c on my windows system.
By default ubuntu 12.04 comes with python 2.7.3 so I am using that only
I downloaded or installed (whatever it does since I am new to django) by issuing the following command-
git clone https://github.com/django/django.git
django directory is successfully created.
I want to create a sample django application. So for this I am issuing the following command-
$ python django-admin.py startproject tango_with_django_project
Obviously, it will throw error since the default ubuntu python doesn't know that django has been installed.
My Question is how to integrate python with this Django and create a sample django application?
The comments above pointing you to the documentation are of course correct, but there are also other resources that can help you start your site the 'right' way. In particular, cookiecutter and its related Django template will get you set up with some really good defaults and valuable third-party apps straight away. If you have cash to spend I'd also heartily recommend the book Two Scoops of Django, by the people who wrote the two applications to which I've linked.
Jeff Knupp has also written a thoroughly useful blog post on starting a Django project the right way, which covers useful topics such as the importance of:
source control;
automated testing (see also this excellent book);
isolating your development environment to smooth deployment; and
managing your database with migrations (included in Django since version 1.7).

How to configure Django, PostgreSQL, Apache and Python?

I am of the PHP background and just have started to learn Django and Python (and loving it). I always used to install WAMP server for PHP development.
Now I dont know how do I configure Django to use PostgreSQL i.e how to make both communicate with each other. I have run some 'hello world' scripts with django. Curretly I have installed Python, django and PostgreSQL. here is the version information
Python : 2.7.2 & 3.2 (i have installed both)
Django : 1.3.1
PostgreSQL : 9.1.2
Apache : 2.2 (..this is from WAMP server)
Os : Ms Windows 7 32-bits (x86)
Since django has builtin development server is it at all necessary to have apache installed and use it instead of that one? If we use the built-in server how we are supposed to configure it for PostgreSQL?.
It is not necessary to have apache installed to develop on django. In fact it is often easier to use the development server because it is single threaded, lightweight, and extremely easy to use. python manage.py runserver 0.0.0.0:8080 to run on localhost port 8080, and your code is easily debuggable.
In django you dont configure your server for a database. You configure your project for a database. All database configurations are kept in the settings.py file located in your main project. Page one of the tutorial explains how to set up a database for your django prject. YOu have to specify, database name, host, port, user and password in your settings.py file.
https://docs.djangoproject.com/en/dev/intro/tutorial01/#database-setup
I would suggest walking through the django tutorial as it addresses most of the issues in setting up development on a new django project.
https://docs.djangoproject.com/en/dev/intro/tutorial01/
I recently deployed a Django based project and found this tutorial to be very helpful and concise.
Django virtualenv Apache2 mod_wsgi
And if you have CentOS, then you can install mod_wsgi as mentioned here:
Django Deployment - Setup mod_wsgi on CentOS
Getting Django to run on Apache requires getting Python to interpret that, you can do this with WSGI. follow the tutorial found here:
https://code.djangoproject.com/wiki/django_apache_and_mod_wsgi
there are other methods to deploy this, you can find here:
https://docs.djangoproject.com/en/dev/howto/deployment/

Django: how to publish an app

I have developed an app using Django 1.1.1 and python 2.7.1. I want to publish it on a commercial website, but not sure which one.
the app works fine on the apache server running on my local machine, however, before investing on a host, I want to be sure that I have the necessary requirements, so if it matters, what are the possible hosts I can use?
I use Apache 2.2 with python 2.7.1 on my local machine running with Django 1.1.1. I use the Windows OS. I tried looking at linode but they don't have a documentation for Windows users in using Django and mod_wsgi, so does it even matter?
This is the first time I try to publish on a commercial site, so I don't want to invest on a host and then find myself stuck and not knowing how to upload my Django app.
Thanks,
You can follow the docs on linode just fine, it doesn't matter that you're a Windows user, the app will be deployed on a linux box.
You can also try a shared hosting solution, that will run django right way, without any need to configure and setup a new machine. My personal recommendation is http://www.webfaction.com/ . Another alternative is https://www.djangy.com/.

Categories

Resources