Tagged: django RSS

  • John 8:34 pm on August 24, 2009 Permalink | Reply
    Tags: , django, , ,   

    More Django Plugin Stuff 

    MonoDevelop Django

    So I’ve been working more on the support for django within monodevelop. Heres some screenshots of it.

    MonoDevelop Django

    MonoDevelop Django

     
    • Aledr 8:47 pm on December 16, 2009 Permalink | Reply

      I’ve just installed MonoDevelop 2.2 and started a new Django project but is no option to create a new App there. Is your code already integrated?

      Thanks.

      • John 11:11 am on December 17, 2009 Permalink | Reply

        I never got round to getting the code into a stable state, and submittting a patch. However I have a couple of weeks of work so I’ll see if have anytime to look at it again.

  • John 10:11 am on August 17, 2009 Permalink | Reply
    Tags: django, ,   

    Hacking on Monodevelop for Django 

    MonoDevelop Django

    So I started to implement support for django with MonoDevelop. It currently has pretty good support for Python via PyBinding addon. At the moment I have only managed to add the ability to create a new django project, which acts in the same way as running

    django-admin.py startproject projectname
    

    But I aim to provide support to add new django apps to the project, once I get familiar with the MonoDevelop code base.

     
  • John 7:03 pm on June 20, 2009 Permalink | Reply
    Tags: django, MSSQL, ,   

    Python and MSSQL 

    I have been playing about with django a fair bit over the last week. After written a small app with django I wanted to import some data from an existing MSSQL database. To get the data into the django model I created a seperate python script to perform the import. Below is a script to import data from a table compaines in a mssql data to a django model called Company. To connect to the mssql server I used the pymssql library.

    #!/usr/bin/env python
    import sys,os
    os.environ['DJANGO_SETTINGS_MODULE'] ='settings'
    # import the modules needed to start the import
    import pymssql
    from datetime import *
    import unicodedata
    from django.core.management import setup_environ
    import settings
    
    setup_environ(settings)
    
    #import the django models
    from apps.clients.models import *
    
    def importCompanies(conn):
    	cur = conn.cursor()
    	cur.execute("""SELECT
    			liCompanyPk,
    			szCompanyName
    		FROM companies""")
    	row = cur.fetchone()
    	while row:
    		company = Company()
    		company.pk = row[0]
    		company.Name = row[1]
    		company.save()
    		row = cur.fetchone()
    
    if len(sys.argv) != 5:
    	print 'data_import.py [server] [username] [password] [database]'
    else:
    	print 'host=%s, user=%s, password=%s, database=%s' % (sys.argv[1],sys.argv[2],sys.argv[3],sys.argv[4])
    	conn = pymssql.connect(host=sys.argv[1], user=sys.argv[2], password=sys.argv[3], database=sys.argv[4])
    	importCompanies(conn)
    	conn.close()
    

    After this I started to play around with pymssql I wanted a quick way to execute simple sql queries, not knowing of an linux alternative to the mysql console client I write another simple script to provide this basic functionality.

    #!/usr/bin/env python
    import sys,os
    import _mssql
    
    if len(sys.argv) != 5:
    	print 'data_import.py [server] [username] [password] [database]'
    else:
    	print 'host=%s, user=%s, password=%s, database=%s' % (sys.argv[1],sys.argv[2],sys.argv[3],sys.argv[4])
    	conn = _mssql.connect(server=sys.argv[1], user=sys.argv[2], password=sys.argv[3], database=sys.argv[4])
    	print '>',
    	cmd = raw_input()
    	while cmd != 'exit':
    		if cmd != '':
    			print cmd
    			try:
    				conn.execute_query(cmd)
    				for row in conn:
    					for i in range(0,( len(row) / 2 )):
    						print row[i],'|',
    					print ''
    			except _mssql.MssqlDatabaseException,e:
    				print e
    		print '>',
    		cmd = raw_input();
    
    	conn.close()
    

    You can download mssql_client.py here

    So after only using for python for a couple of weeks It’s definitely powerful and fun to code with. Now to try out for all of the libraries that provide bindings such as pysvn or pyldap.

     
  • John 9:17 am on June 12, 2009 Permalink | Reply
    Tags: django,   

    Django and Python 

    I have recently started having a play about with django. After reading loads of about it and have a little play about with snowy (a django based note sync for tomboy). After getting used to coding in python I found django really quick to develop in. But the documentation is by far the best thing about the project. There’s loads of the stuff, and its brilliant. Its readable. Its completely unlike reading other tech documents. If this isn’t a good selling point for checking it out then I don’t know what is because RTFMing has never been so easy.

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel