Re: How to Sign In as a admin or Staff in Django Site?

2013-10-08 Thread Andrew Farrell
Hi Mamarth, Follow the directions under "Overview" here: https://docs.djangoproject.com/en/1.6/ref/contrib/admin/, found by googling "django admin site" Create a staff account with the command `manage.py createsuperuser`, and then go to yoursite.com/admin/ (or localhost:8000/admin/) to sign in

Re: django debugger

2013-11-07 Thread Andrew Farrell
It is possible to use pdb (or ipdb: https://pypi.python.org/pypi/ipdb) by inserting a set_trace() call and then running the django dev server with `manage.py runserver`. For example, the following will print the number of database queries before and then after a function which touches the datab

Re: Sqlite3 to Postgres Migration?

2015-02-20 Thread Andrew Farrell
One approach may be to use django-import-export to add to the admin interface the capability to export your data to CSV (or JSON or Excel) and likewise to import it. Then, simply run two instances of your app: one on top of postgres, one on

Re: Python / Django slow ? Deciding my next technological stack

2015-02-24 Thread Andrew Farrell
As Vijay said, most of the performance of a web app (in any framework) is database access. With django, you can use the Django Debug Toolbar or the db.connection.queries

Re: django deployment in a virtual machine.

2015-02-25 Thread Andrew Farrell
Linode and Digital Ocean both have good tutorials on setting up a production deployment o

Re: Can't run django!

2015-03-04 Thread Andrew Farrell
You might see if DEBUG is being set to False in an unexpected location by using the silver searcher (also on windows ) to quickly search for a string in a directory tree. $ ag DEBUG within your a

Re: Future for Django, Jobs, Confused :/

2015-03-04 Thread Andrew Farrell
One thing to keep in mind is that there are more fields using primarily python than using primarily ruby. A company that that does primarily scientific computing in python may not advertise jobs in Django or Flask. However, when they need to build a web interface for something, they will reach for

Re: First time user, can't start project!

2015-03-10 Thread Andrew Farrell
What platform are you on? Does it print out anything? What does running the command `dir` show before and after running `django-admin.py startproject mysite` ? On Tue, Mar 10, 2015 at 12:09 PM, wrote: > Hi! > > I ran the command to get my version and it worked. However when I run: > django-admin

Re: Import error - No module named http

2015-03-18 Thread Andrew Farrell
Hello Nivin, Could you please hit the "switch to copy-and-paste view" link at the top of the tradeback and copy that? The bottom of a traceback is often the most useful for debugging. Feel free to paste it or relevant code at github gist and send the link if you want to

Re: How to make request ie GET/POST to soap (windows web service ) in Django?

2015-03-18 Thread Andrew Farrell
Based on a brief search but no personal experience, SUDS looks like the best python library for making requests to an existing SOAP server. On Wed, Mar 18, 2015 at 11:16 AM, SHINTO PETER wrote: > How to make request ie GET/POST to soap (windows

Re: Import error - No module named http

2015-03-18 Thread Andrew Farrell
So it seems like the problem is that you are doing `import http` on line 24 of /home/akhil/Documents/NIVIN/NIVIN/svn/CrossFraudet/ branches/V2.1.0/crossfraudet/cdrimport/views/fraud_summary_view.py rather than `import httplib`. Python2 doesn't have a module in the standard library named `http`, onl

Re: Import error - No module named http

2015-03-18 Thread Andrew Farrell
Actually, please listen to Guilherme over me; He seems to have correctly spotted the omission. On Wed, Mar 18, 2015 at 11:45 AM, Andrew Farrell wrote: > So it seems like the problem is that you are doing `import http` on line > 24 of /home/akhil/Documents/NIVIN/NIVIN/svn/CrossF

Re: newbie question

2015-03-19 Thread Andrew Farrell
The other commenters are right that reading the tutorial is a good use of your time. https://docs.djangoproject.com/en/1.7/intro/tutorial03/ is the section relevant to your question. On Thu, Mar 19, 2015 at 10:39 AM, Javier Guerra Giraldez wrote: > On Wed, Mar 18, 2015 at 9:41 PM, VMD wrote: >

Re: importing csv data into database

2015-03-31 Thread Andrew Farrell
Hello Sum, There are two approaches you could take. One is to install a plugin like django-import-export and then use it's import functionality. Its been a while since I've done this, but when I did under django-1.4 it Just Worked. This is

Re: Alternatives to Django REST Framework

2015-04-09 Thread Andrew Farrell
Someone I met at the Austin python user group told me they'd built their company's backend using Falcon and were very happy with it. On Thu, Apr 9, 2015 at 7:54 AM, Amit Prahesh wrote: > Hi, > > while Django REST Framework seems wonderful to me, it is a heayweight >

Should squashmigrations produce a migration that could be improved by editing?

2015-04-17 Thread Andrew Farrell
Hi Folks, I recently squashed 93 migrations down to 1 in order to improve the speed at which tests ran. (5 tests took about 70 seconds to run before. Now they take 13.) I noticed that the resulting migration had a large list of small operations, mostly migration.AddField. What I have two questions

Re: error logging with nginx and uWSGI

2015-04-23 Thread Andrew Farrell
Hi Larry, What does cd /etc/nginx && ag log Give you? On Thu, Apr 23, 2015 at 1:05 PM, Larry Martell wrote: > This is not really a django question, but I think these are issues > folks here have faced, so I hope someone can help me. > > Prior to now, all the django p

Re: importing csv data into database

2015-04-23 Thread Andrew Farrell
; > > Cheers, > Sum > > > On Wed, Apr 1, 2015 at 1:51 PM, sum abiut wrote: > >> Thanks guys, >> appreciate your help. Yes i am looking to have a form that accepts CSV >> files. I will have a read on the link that you guys have provided and see >> how it goes.

Re: importing csv data into database

2015-04-23 Thread Andrew Farrell
prise', 'fanatical devotion to the pope', and in fact weapons = 'fear', creates a 1-item tuple. On Fri, Apr 24, 2015 at 12:33 AM, Andrew Farrell wrote: > could you replace your function with > def readcsvfile(request): > with open('/var/www/html/webapp/

Re: importing csv data into database

2015-04-25 Thread Andrew Farrell
data=test() > data.PersonID=row[0], > data.FirstName=row[1], > data.LastName=row[2], > data.Address=row[3], > data.save() > return render_to_response('csv_test.html',locals()) > > > > > On

Re: importing csv data into database

2015-04-26 Thread Andrew Farrell
,lastname,address. > Please advise > > > Cheers > > On Sun, Apr 26, 2015 at 2:36 AM, Andrew Farrell > wrote: > >> Ah, I suppose that bit didn't get sent. Google groups only lets mail from >> my old gmail address through and bounces mail from the MIT address I

Re: How to find a view in a complex web application

2015-04-28 Thread Andrew Farrell
If you are asking this question as a developer who wants to know what view to use to affect a page when you know the url, I recommend you install The Silver Searcher , which lets you run $ ag 'some arbitrary text you might find on a page' and it will quickly show you ev

Re: Why so complicated :O??

2015-05-06 Thread Andrew Farrell
Hi Vesko, I might take a look at Harry Perceval's Test Driven Development with Python , which is available for free. Although the book focuses on teaching TDD, it teaches Django along the way and does so by focusing on getting the smallest piece working at a tim

Fwd: What is the ideal web server to use with Django?

2015-05-14 Thread Andrew Farrell
Ashkat, I second the recommendation that Ashkat go with gunicorn+nginx for the same reason Avraham does. Digital Ocean has a good walkthrough of how to set that up here . One t

Re: django-admin.py --> permission denied (shared server deployment)

2015-05-19 Thread Andrew Farrell
Hello Florian, If you are having trouble installing python without root permissions, you should consider installing the miniconda distribution of python that is used in the scientific computing community. Assuming you are on a linux server, you can do this

Also: installing postgres w/o root Re: django-admin.py --> permission denied (shared server deployment)

2015-05-19 Thread Andrew Farrell
7;PORT': '5432', } } Then you can set up your tables with python manage.py migrate You can also log in to the database with python manage.py dbshell On Tue, May 19, 2015 at 11:50 AM, Andrew Farrell wrote: > Hello Florian, > > If you are having trouble installing python

How do I patch django.core.mail.send_mail for testing?

2015-05-19 Thread Andrew Farrell
Hi folks, I'm trying to use mock.patch to test that a particular post-save signal kicks off an email. My current approach to this is... from django.test import TestCase from mock import patch class RegisterTestCase(TestCase):

Re: can i use sqlite for big project?

2015-06-26 Thread Andrew Farrell
Arindam, Here are two routes you should consider: 1) Develop your site using SQLite until you get to the point of needing something more performant under heavy loads, then switch over. By the time you switch, you will have developed a deeper understanding of Django and also will have demonstrated

Re: Python & Django.

2015-07-05 Thread Andrew Farrell
Could you please paste a reply with: - The operating system you are running on - The output of the command "pip freeze" - The commands you are entering to try to run django on python 3.4 and the output of those commands ? On Sun, Jul 5, 2015 at 8:44 PM, Steve Burrus wrote: > > *"Are you getting

Re: What is _set and where is it documented?

2015-07-13 Thread Andrew Farrell
Hello, One relevant bit of the documentation for what you are asking is following-relationships-backward . On Mon, Jul 13, 2015 at 3:13 PM, wrote: > I've been working through "Writing Your first Django A

Re: Your opinion on which technologies to use when building web applications

2014-07-23 Thread Andrew Farrell
1) You never linked to the survey. 2) I hope when you do link to the survey, your data collection includes the fact that it comes from people subscribed to django-users@googlegroups.com and therefore comes from people who value the approach django takes. On Wed, Jul 23, 2014 at 10:05 AM, Master T

Re: How to run Python script? (configure settings error)

2014-08-13 Thread Andrew Farrell
Note: this is much better documented at https://docs.djangoproject.com/en/dev/howto/custom-management-commands/ You want to move this file to the management.commands module. I don't know what the equivalent commands are on windows, but on linux this would be. 1) `cd myapp; mkdir management`: Withi

Re: How to run Python script? (configure settings error)

2014-08-13 Thread Andrew Farrell
oh, and you should then be able to run the command by doing python manage.py myapp mycommand and see the 'mycommand' in the list of commands printed by `python manage.py help` On Wed, Aug 13, 2014 at 10:36 AM, Andrew Farrell wrote: > Note: this is much better document

Re: Django app deployment step-by-step

2014-08-13 Thread Andrew Farrell
I've tried to get django running without shell access and it was a headache. You can get a good server with shell access for $10. Unless you are far smarter than I, you will almost certainly waste more than hours trying to get django to work without shell access. With two of those hours, you would

Re: Improvement to objects.get_or_create and objects.update_or_create

2014-08-25 Thread Andrew Farrell
I have long wanted something like this. However, it would need to be able to handle: 1) possible unique_together clauses 2) communicating clearly to the user what it tried to do and what went wrong when it errors The thing that has made me wary of suggesting something like this is the fact that un

Re: Expected performance of the django development server?

2015-01-04 Thread Andrew Farrell
The django development server is slow by intentional neglect; It isn't supposed to be used in production because the django team does not want to divide its focus by supporting a full-fledged web server that is performance-optimized and security-audited. They want to include a development server th

Re: Expected performance of the django development server?

2015-01-04 Thread Andrew Farrell
To clarify: I'm not a django core dev and by "neglect" I don't mean that anyone is being neglectful, just focusing efforts elsewhere. On Sunday, January 4, 2015, Andrew Farrell wrote: > The django development server is slow by intentional neglect; It isn't > su

Re: Expected performance of the django development server?

2015-01-04 Thread Andrew Farrell
. (See also: http://stackoverflow.com/questions/2133627/using-django-db-connection-queries ) On Sunday, January 4, 2015, Andrew Farrell wrote: > To clarify: I'm not a django core dev and by "neglect" I don't mean that > anyone is being neglectful, just focusing effort

Re: Adding Objects to Query Set

2013-12-16 Thread Andrew Farrell
It sounds like you just want a set of projects and don't actually need a querySet. You can do this with projects = set( Project.objects.filter(owner=request.user).all() ) member_projects = set( ProjectMember.objects.filter(member = request.user) ) total_projects = set(projects) | set(member_project

Re: Django ORM & DB backend coupling

2013-12-24 Thread Andrew Farrell
This seems like it would be a reasonable idea if the API represented a data model that was fundamentally relational in character. However, many are not. An API should be designed such that it is the best way to interact with its data model, so trying to shoehorn it into an ORM's API seems like it w

Re: New to Django; Question

2013-12-30 Thread Andrew Farrell
Cognitive advice: Since you are new to django and since figuring out how to deal with the legacy database interacting with the django ORM, ignore templates at first. Focus on writing a function that you can run from `manage.py shell` to extract and display the data, even in just a python dictionary

Re: Error when using apache 2.4.6

2014-01-17 Thread Andrew Farrell
To bisect your problem, I think that the error happens before the wsgi file even runs. you can test this by putting assert False at the top of /home/jass/Automation/apache/django.wsgi and seeing if the error changes to a 500. If it doesn't, I'm right. If it does, the problem is in django.wsgi Give

Improving django test startup performance.

2014-03-05 Thread Andrew Farrell
ing: - reordering the paths assigned to sys.path - removing items from sys.path when I am running tests - caching the locations where modules were previously found and looking there first Has anyone looked at doing anything like this? -- *Andrew Farrell* Software Engineer *|* MassChallenge, I

Re: Improving django test startup performance.

2014-03-05 Thread Andrew Farrell
is almost certainly something in the test discovery process. I suppose this means that digging up and mapping out the piping that runs through nose <https://github.com/nose-devs/nose>, django-nose<https://github.com/django-nose/django-nose>, the django test-discovery code

Re: Template

2014-04-17 Thread Andrew Farrell
Do you mean that you are new to the syntax of django templates so you just want to look at and see what django templates look like? Take a look at the ones used in the admin of django itself: https://github.com/django/django/tree/master/django/contrib/admin/templates/admin index.html is a reasona

Re: Django app

2014-04-17 Thread Andrew Farrell
I'm a bit confused. Are you looking for something other than the Django Tutorial found here: https://docs.djangoproject.com/en/1.6/intro/tutorial01/? It takes you through building up an application. Or is that what you are looking for? On T

Re: Please help me out, I tried to get sync for whole day @@

2014-04-19 Thread Andrew Farrell
This looks like you have an index error in your settings.py file. Probably an extra space at the start of line 58. If you run python settings.py, you probably get the same error. On Sat, Apr 19, 2014 at 10:02 AM, Toan ComS wrote: >

Re: Django export the CSV file from database

2014-05-21 Thread Andrew Farrell
So the error is somewhere here: for att in attendance: day = att[2].day But I can't see where `attendance` is defined. I suspect you'll have a similar error in for leav in leavework: day = leav[2].day But also can't see where `leavework` is defined. On Wed, May 21, 2014 at 10:24 PM, hito

Re: django models

2014-06-02 Thread Andrew Farrell
hrough someone else's django project but would find some broader context useful. If you haven't already, I would recommend working through the tutorial, starting here: https://docs.djangoproject.com/en/dev/intro/tutorial01/ best regards, Andrew Farrell On Mon, Jun 2, 2014 at 8:51 PM, ngangs

Re: Django python fuction

2014-06-10 Thread Andrew Farrell
In general, I recommend adding the line "import pdb;pdb.set_trace()" to the top of your function and walking through it to see why it doesn't work. def foo(x): import pdb;pdb.set_trace() list = [] if isinstance(x, list): for i in x: elem = i return list

Re: Angular and Django

2014-06-22 Thread Andrew Farrell
Doug, I'm very interested to hear that Angular is more powerful than Ember. After some indecision between Ember and Angular, I decided to start picking up Ember on the advice of a friend that it was the more powerful of the two. Therefore, if you have anything I might read to contradict that, I'd b

Re: please suggest me, related to technologies that I should use for facebook like chat

2015-08-10 Thread Andrew Farrell
This is orthogonal to Django, but I would take a look at TornadIO and https://github.com/MrJoes/tornadio/tree/master/examples/chatroom On Mon, Aug 10, 2015 at 8:56 AM, JAI PRAKASH SINGH < jaiprakashsingh...@gmail.com> wrote: > Hello all, > > > I want to to make a facebook like chat applicatio

Re: How to use Django 1.8.2 with Python 2.7?

2015-08-11 Thread Andrew Farrell
Hi jsachs, Could you reply to the list with a couple copy-pasted outputs to help diagnose the problem? 1) From the window shell, could you run `python manage.py shell` and paste the output? Could you also please run `dir` and paste that output? 2) Could you also trigger that same error the full er

Re: Learning Python and Django and should I?? (I have a year of 10 or so hours a week)

2015-08-14 Thread Andrew Farrell
One tool for debugging that I would actually use isn't actually a debugger although ipdb is great . If you decide to go with python/django, I would strongly consider using the book Test Driven Web Development with Python

Re: What I need to know to be a Django full stack developer?

2015-09-04 Thread Andrew Farrell
For the devopsy things you mention, the second best way to learn that is to spin up a $5 VPS and work through tutorials like how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-14-04

Re: Hi

2015-10-03 Thread Andrew Farrell
If you already have python 3.5 installed globally, then you can do ``` $ which python3.5 /usr/bin/python3.5 $ virtualenv -p /usr/bin/python3.5 ~/trying35 ``` to create a virtualenv with python3.5 in it. If you use the conda package manager, you can do ``` c

Re: Using Django and R in a production environment?

2015-10-07 Thread Andrew Farrell
One option is to use the conda package manager (you can get that here ) to create an environment with `conda create --name django+r django=1.8` activate it with `source activate django+r` And then install R packages with something like `conda install --channe

Re: Apache2, mod_wsgi and django setup

2015-11-12 Thread Andrew Farrell
Others on here should jump in with help with your other questions but I think you should find the answers to your first and third by running `ps aux | grep apache` and looking at the first column. You might also find it enlightening to run `ps auxf | grep apache -B 2`. On Thu, Nov 12, 2015 at 4:34

Re: matching query does not exist.

2015-11-19 Thread Andrew Farrell
return redirect('signup') request.POST.get('shift_id') returns None. When that gets passed to mealShifts.objects.get(pk=shift_id), it raises the error. You can confirm that by inserting the line import pdb;pdb.set_trace() before that line and run `print(request.POST.ge

Re: am new to django and at a dead end or so i think

2015-12-03 Thread Andrew Farrell
en running it with C:\Users\LENOVO> python testsyntax.py I'm running on OSx. I don't know why the syntax should fail in one case and succeed in the other, but it is worth a try. -- Andrew Farrell On Thu, Dec 3, 2015 at 7:56 AM, Emmanuel Olodun wrote: > Microsoft Window

Re: Need a Tutorial

2015-12-05 Thread Andrew Farrell
Python tutorials: The tutorial I first learned python from was Think Python , which is free to download. That was several years ago and better things have been written since. I am a fan of the approach that Learn Python the Hard Way

Re: am new to django and at a dead end or so i think

2015-12-07 Thread Andrew Farrell
(moving back on-list so that others can jump in to help) Short answer: check in settings.py to make sure that INSTALLED_APPS doesn't list the same app name twice. -- Okay, this is different! We tried to "stimulate the error" *, and we've found that on closer inspection that the same SyntaxE

Re: Migrate django project to eclipse/pydev ide

2015-12-22 Thread Andrew Farrell
Could you also tell us: 1) Why you need to switch to Eclipse specifically rather than PyCharm , SublimeText , or (the one I use) Atom ? 2) What error Eclipse is s

Re: Using API's efficiently in the framework

2015-12-27 Thread Andrew Farrell
It looks like you several words. To pre-empt a question you might be asking, if you are trying to call out to an API during the request-response cycle, you can find that the request to your app times out. To solve this, people often use a task-runner such as celery (https://github.com/celery/celer

Re: Setting up Django

2016-01-16 Thread Andrew Farrell
you want class Choice(models.Model): Note the capitalization of Model. By convention, class names in python should be capitalized. On Sat, Jan 16, 2016 at 5:56 PM, ofeyofey wrote: > hi, > > I see the error there was dateTimeField and corrected that but now I > get > > pi@raspberrypi ~/Djan

Re: Diving into Django 2016

2016-02-09 Thread Andrew Farrell
get a $10 credit if you sign up using this link <https://www.digitalocean.com/?refcode=6dade5c581b8>, so it is free for two months. All the best, Andrew Farrell PS. If you want to learn more about setting up servers, I'll shamelessly plug this tutorial I wrote <https://amfarrell

Re: How to update a live / deployed Django project?

2016-02-10 Thread Andrew Farrell
> I have been through several variations on what you are doing. The solution which has worked best for me is to use SaltStack to control the update. If you are interested in learning SaltStack, I just recently wrote a step-by-step tutorial