đž Archived View for chirale.org âş 2012-10-08_637.gmi captured on 2024-08-24 at 23:55:38. Gemini links have been rewritten to link to archived content
âŹ ď¸ Previous capture (2024-05-12)
-=-=-=-=-=-=-
I had a bad morning trying to repair my Cygwin installation from a virtualenv mess. Itâs time to get a Debian and install it on a Virtualbox for my new django project!
Choosing the distro: what I want
Iâm a Debian fan from years so I go to the Debian website and download Wheezy netinst iso (32 bit, since Iâm on a 32 bit OS and I want to use more core): wheezy met all the requirements above.
I already have a Virtualbox, so what I do is to add a new virtual disk and to add the new Wheezy netinst iso on CD/DVD images. Then I create a new Debian machine (32 bit) with two cores. I choose the iso image to be mounted on startup so the Debian setup process will start on boot.
As network device, I choose the Bridge option, so I can access the machine later from my windows host.
Installing the system
When you turn your machine on, many choices will be prompted to you. I install the webserver (apache) from the list, removed SQL server and print server and then leave desktop selected and the other default values. After some minutes Debian is installed and I can log in with the credential I have specified during installation.
Use WORKGROUP as network name if youâre running a Windows host when asked.
Install django packages
Under the Application menu, find the Debian package management tools to install what you want. As the requirements Iâve listeded above I search and install those packages:
Later you can install more useful packages like virtualenv and phpmyadmin.
After youâve installed those packages, you can do some test. Open a shell (Accessories \> Terminal) and then type these commands:
What version of python Iâm running?
$ python
Python 3rc2 (default, Apr 22 2012, 22:35:38)
\[GCC 3\] on linux2
Type âhelpâ, âcopyrightâ, âcreditsâ or âlicenseâ for more information.
\>\>\>
So Iâve python Good!
\>\>\> import django
\>\>\> django.VERSION
(1, 4, 1, âfinalâ, 0)
And Iâve Django
Share your code to the Windows network (workgroup)
Now I want to read the code from one machine to another. I choose Samba server to read and write files from the virtual machine to windows and back. It will be useful since Iâve a complete Eclipse + pydev IDE on windows and I love work with it.
I open a Root terminal and type:
\# ifconfig
If you choosed the Bridge network interface on installation, you will got something like this:
eth0 Link encap:Ethernet HWaddr ??????
inet addr:104 Bcast:255 Mask:0
inet6 addr: ???????????/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:49280 errors:0 dropped:0 overruns:0 frame:0
TX packets:19777 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:45400047 (2 MiB) TX bytes:1887849 (8 MiB)
Interrupt:19 Base address:0xd020
The address in bold (104) is the local network address of my virtual machine. If I just type this address in the Chrome browser itâs running on Windows (host) I got the âIt works!â from Apache on the virtual machine. If you canât see nothing, left click on the network icon on the bottom of your virtualbox windows \> click on the menu voice and then choose the Bridge option. Then redo the ifconfig as above.
Samba tuning
Create a directory to store your django code (inside current user home folder). Open the terminal as normal user:
$ cd
$ mkdir my-django-code
Then share this folder with samba. To do this, letâs create a new user without a password:
adduser guest âhome=/home/public âshell=/bin/false âdisabled-password
Then add these lines to /etc/samba/smb.conf on â## Authentication \##â section:
security = share
guest_account = guest
invalid_users = root
obey pam restrictions = yes
And then after the \[cdrom\] commented text:
\[my-django-code\]
comment=Django-code
read only = no
locking = no
path = /home/myuser/my-django-code
guest ok = yes
force user = myuser
Where myuser is my (normal) user name. The lines above tell something like this to samba:
The âmasqueradeâ thing is all about having the right to write files created from myuser from the guest user on the host.
When i browse my Workgroup on windows, I found the machine name I choose during installation and inside I found the my-django-code directory. I try to read and write files from the host (Windows) and from the guest (Debian) and itâs all ok.
Django, finally!
If youâre starting to develop on django, so this howto for beginners will help you a lot. Since Iâve installed the python-django package from Debian, to start a project is simple as typing this:
$ cd
$ cd my-django-code
$ django-admin startproject django_unchained
$ cd django_unchained
$ python manage.py runserver 104:8000
Where 104 is the virtual machine local network address from above and 8000 the port of the django testing webserver.
I type:
on Chrome (host: Windows) and I get the hello page from Django. Perfect!
Then, I can just follow the django howto to do the right things during the creation of my new app django_unchained!
You can also explore the must-have list of tools and sites for Python developers.
must-have list of tools and sites for Python developers
https://web.archive.org/web/20121008000000*/http://www.debian.org/devel/debian-installer/
https://web.archive.org/web/20121008000000*/https://www.virtualbox.org/
https://web.archive.org/web/20121008000000*/http://www.eclipse.org/
https://web.archive.org/web/20121008000000*/http://pydev.org/
https://web.archive.org/web/20121008000000*/https://docs.djangoproject.com/en/dev/intro/tutorial01/
https://web.archive.org/web/20121008000000*/http://192.168.0.104:8000
https://web.archive.org/web/20121008000000*/https://docs.djangoproject.com/en/dev/intro/tutorial01/