You've left out the most important bit - the actual traceback error. What is it?
If it can't find something, then it could be a PYTHONPATH issue.
Google tells me PT4VS may not support the usual way modules are
discovered (http://pytools.codeplex.com/discussions/254602), although
that should affect IronPython only, and not CPython (possibly
intellisense as well).
Inside PT4VS, in the interactive window, type in the following and
paste the result -
import sys
print sys.path
> Additionally in PT4VS there is a field for a startup script. I wrote one and
> here it is:
>
> import os
> import IPython
> import django
> os.chdir('c:\\MTDevelopment\\Django\\newartists')
>
> This so that I could change my directory to where my startproject was set
> with all the django web framework files. Also to import IPython and django
> as you see here. That seemed to work as I anticipated.
This smells like a hack. Your default working directory should already
be the directory your app is in. If it isn't, you need to check your
project settings (you are using a Python VS project right?).
> What I am asking you is why am I not able to get the full power of Django?
> In my command prompt I wasn't inside the python interpreter and ran the
> Django commands and everything worked fine. However, I was under the
> impression that with a Python interpreter in VS that I could have everything
> come in in a start up script and just go on my way coding with Django having
> set the directory to the location of my startproject?
>
> When I type: django and IPython into my PT4VS now I see:
>
>>>> IPython
> <module 'IPython' from
> 'C:\Python27\lib\site-packages\ipython-0.11-py2.7.egg\IPython\__init__.pyc'>
>>>> django
> <module 'django' from
> 'C:\Python27\lib\site-packages\django-1.3.1-py2.7.egg\django\__init__.pyc'>
>
> so it is imported it correctly I think but I'm not able to use it. I've been
> working hard on teaching myself how to get all this set up and any help from
> you all would make my time working on this a lot easier!
>
> Thanks so much,
>
> JJ Zolper
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/P5AJ334Yr8YJ.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
You've left out the most important bit - the actual traceback error. What is it?
If it can't find something, then it could be a PYTHONPATH issue.
Google tells me PT4VS may not support the usual way modules are
discovered (http://pytools.codeplex.com/discussions/254602), although
that should affect IronPython only, and not CPython (possibly
intellisense as well).
Inside PT4VS, in the interactive window, type in the following and
paste the result -
import sys
print sys.path
These 'Django commands' you're referring to, i.e. those involving
manage.py, are commands that are meant to be run from the command
prompt. You are executing a python script file, but they are not
Python commands.
> SO....
>
> Is your best advice to have a OS prompt open in tandem with my Visual Studio
> Python Interpreter open? That being said that would be the best solution
> given my situation I suppose. However within the interpreter Python Tools
> for VS there may be limitations. That is what I've heard at least. I'm just
> referring to the interactive intellisense I think?..
VS doesn't work well outside of a VS project. Without one, it won't
know what your Python search path is, where all your code is located,
so you'll have minimal Intellisense (it'll know about the built-in
Python libraries, but not much else). You'll may also have issues
executing code because it doesn't know how to find all your code and
dependencies without the Python search path, and without that you'll
probably also lose the great debugging abilities of VS. All you're
really left with is a glorified syntax-checking text editor.
If you really want to do that, then the best solution is to open a
separate Command Prompt to run 'manage.py runserver' from. I mentioned
CPython before; that's just a name for the Python you download from
python.org. I used it to differentiate that from IronPython, which is
a .NET implementation of Python. I believe there are outstanding
issues with Django and IronPython, so it probably isn't worth trying
that.
You also seem to be confused with a Django project vs. a VS project. A
Django project simply defines the directory structure, and gives you a
few files to start with, including manage.py. This structure is how
Django is able to find the various files it needs.
A VS project is necessary to let VS know where all your files are,
where it should look for your Python packages etc. It is for VS to
know how to execute, debug and manage your code. Django does not know
anything about the VS project, and it shouldn't because it has nothing
to do with Django once Django is running.
Once you've created a VS Python Application project (ideally in the
same directory as your Django project), here's how to make it run the
built-in Django test server -
1. Right-click on your VS project in the Solution Explorer, and click
Properties.
2. Click on the Debug tab.
3. In 'Script Arguments', type 'runserver'.
4. Save the Project properties.
5. Add the files in your Django project to your project by
right-clicking on your VS project, Add, Existing item.
6. Right-click on manage.py and select 'Set as Startup File'.
To test, just go Debug -> Start Debugging or press F5.
I've had a quick play around; looks like the 'Execute project in
Python Interactive' option doesn't pass script arguments along, so
that won't work for running the test server, but then again, there's
nothing to interact with in the test server anyway. You can use that
option to test out models and the Django API though.
> Thank you for the tip on starting my server Andrew I will surely exit the
> Python interpreter and use a prompt!
>
> JJ Zolper
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/y2Pz2JDeEo0J.
yes - especially if you are using OSM, postgresql is essential.
--
regards
Kenneth Gonsalves
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/2LQU1l81OyoJ.
Python Tools for Visual Studio should automatically detect CPython if
you have that installed. If you haven't, I suggest you download an
install a CPython distribution called ActivePython Community Edition
(http://www.activestate.com/activepython/downloads). It will set up
Python in your Windows environment properly, which the official one
doesn't seem to do right (judging by the posts here about Windows).
The bonus with VS is the great debugger, which works with CPython as
well. Many of the IDEs mentioned are just great text editors, and
don't include a debug environment (i.e. the ability to set
breakpoints, explore stack, step through code visually etc.). Some do
include such an environment, including PyCharm and PyDev.
PostgreSQL also works fine on Windows. No idea about all the GIS stuff
though. If you're comfortable with using Linux, then go for it, but
most of the basic stuff you can do on Windows (until you need other
bits of software to make things work, like Redis). Unless you have a
preference for Windows though, I wouldn't use it as a Django app web
server in production; there's far less support on the net to help you
out when things go wrong.
I use ActiveState Komodo Edit on Windows to modify files on my Linux
VM which runs the web server for my Django apps. It means I don't get
a debug environment though; working on finding something to make that
work.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/2LQU1l81OyoJ.
The keywords were 'in production'. The development server (i.e. python
manage.py runserver) works fine under Windows. But when you want to
make the website accessible to your audience (the internet, company
etc.), you should host that on Linux.
>> I use ActiveState Komodo Edit on Windows to modify files on my Linux
>> VM which runs the web server for my Django apps. It means I don't get
>> a debug environment though; working on finding something to make that
>> work.
>
> So I should install ActiveState Komodo Edit to Windows. Which in turn well
> help me to work with my Django server through a Virtual Machine?
That's one way. It's a bit more complex than simply doing everything
inside a Linux VM. Komodo Edit also works in Linux as well.
> If I have this right I should install my CPython distro to VS and build my
> Python on Windows in VS. Then on the side I should have a VM running with my
> Django server (aka my Django project)?
See above; the runserver command works fine under Windows.
> JJ
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/1Efy7_gaDdgJ.
When you are developing your Django app, the development server that
comes with Django (python manage.py runserver) works fine on Windows.
When you are ready to move things into production for everyone else
access, you should not use the development server; instead you should
use a proper web server, e.g. nginx, cherokee or Apache. Those web
servers tend to be better documented on Linux.
If it makes things easier, just do everything on Linux.
> I have installed ActiveState and will give it a try. I have my VS up and
> running with Python Tools for VS so that should be okay.
>
> Hey Sam you've been a great help. Would you by chance mind giving me your
> e-mail address? That way in the future I could work with you? I won't bother
> you too much don't worry! lol. Just since I am trying your advice it could
> be a great help to me.
>
> What Virtual Machine did you pick? What Linux version are you running?
I'm just using VirtualBox, running a whatever Linux distro I happen to
like at the time, e.g. CentOS, Ubuntu etc.
> If you prefer e-mailing/want to give me your address my next inquery would
> just go to your e-mail.
>
> Thanks so much!
>
> JJ Zolper
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/nMqg8xOLXRcJ.
> When you are developing your Django app, the development server that
> comes with Django (python manage.py runserver) works fine on Windows.
> When you are ready to move things into production for everyone else
> access, you should not use the development server; instead you should
> use a proper web server, e.g. nginx, cherokee or Apache. Those web
> servers tend to be better documented on Linux.
> If it makes things easier, just do everything on Linux.
So by everything you mean my Django project would be made within the VM and UNIX/Linux?
> I'm just using VirtualBox, running a whatever Linux distro I happen to
> like at the time, e.g. CentOS, Ubuntu etc.
Okay I've used VirtualBox before. Thanks!
http://www.openstreetmap.org/
--
regards
Kenneth Gonsalves
Yes I knew I was in the Python shell I just never saw anything that described you couldn't make Django commands within the Python interpreter. I mean it is based on Python isn't it? That's where I thought logically you could make Django calls from in Python?
SO....
> The keywords were 'in production'. The development server (i.e. python
> manage.py runserver) works fine under Windows. But when you want to
> make the website accessible to your audience (the internet, company
> etc.), you should host that on Linux.I still don't quite understand. Can you explain more? I would think this means that my Django files should be on a Linux portion of my web server? I am with Bluehost.com
I have installed ActiveState and will give it a try. I have my VS up and running with Python Tools for VS so that should be okay.Hey Sam you've been a great help. Would you by chance mind giving me your e-mail address? That way in the future I could work with you? I won't bother you too much don't worry! lol. Just since I am trying your advice it could be a great help to me.What Virtual Machine did you pick? What Linux version are you running?
If you prefer e-mailing/want to give me your address my next inquery would just go to your e-mail.Thanks so much!JJ Zolper
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/nMqg8xOLXRcJ.
Definitely try out running a development websever './manage.py runserver
is fine) on Linux, to get a feel for what your production environment
might be like. You might decide you like working on Linux, and it make
you more productive---or not. But---at least for Django/Python---that's
largely a matter of taste.
yes
--
regards
Kenneth Gonsalves
upgrade to linux and stop worrying
--
regards
Kenneth Gonsalves
google maps are proprietary. OSM in open source - end of discussion.
--
regards
Kenneth Gonsalves
Have you installed the VirtualBox Guest Additions? That will, among
other things, optimise your video which should make it feel a lot
faster.
This looks like a good guide for installing it on Ubuntu 11.10 -
http://www.varunvats.com/2011/06/install-virtualbox-guest-additions-for-ubuntu-11-04-guest/
> Before I go too far into writing code I was hoping to "perfect" my
> environment. I want to be able to donate enough resources such as RAM to the
> VM so that it runs well but at the same time maintain a steady local Windows
> boot.
>
> Would you mind helping get me situated?
>
> My Laptop is a Fujitsu Lifebook T5010. A 231 GB HDD with 4 GB RAM. I have
> Windows 7 Enterprise 64 bit operating system installed.
>
> The original or current setup for my Ubuntu 11.10 on my VirtualBox system
> is:
>
> Base Memory: 700 MB (RAM? max is 4096)
> Storage: 40 GB (Fixed)
> Video Memory: 12 MB (max is 128)
> Monitor count is 1
>
> Those are all the details I thought might be useful. I would really
> appreciate some guidance as to what you set yours up as or what you think
> might be the best to optimize performance?
>
> As a side note I'm really asking anyone in this thread what their opinion
> is? I plan is to look through this thread and see who else mentioned Linux
> and see if I can get input so I'm ready to go before I dive too deep into my
> development.
>
> Thanks to you and to everyone who has been very patient with me, given me so
> many tips, and stepped me through my setup!
>
> Much appreciation,
>
> JJ Zolper
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/y689VFsrhDUJ.