Showing posts with label python. Show all posts
Showing posts with label python. Show all posts
Monday, July 10, 2017
Django trick keep runserver from crashing on Python syntax error
Django trick keep runserver from crashing on Python syntax error
When developing Django, the "runserver" command is convenient. It runs our appserver, and reloads itself when we change our apps source code. We can have a rapid "edit stuff then see what happened" cycle.
However, runserver it has an annoying habit. If were typing so fast that we add a Python syntax error into our code, the command will crash. We expect that when we fix the syntax error, we can see our results, but it doesnt work. The appserver has crashed, and is no more.
The following workaround works wonders. If we add a syntax error, "runserver" will crash, and this loop will wait for a moment then re-run it. We can now type as fast as possible all the time, and Django will always show us what we want to see. Or, what we give it, which sometimes is enough ;)
while true; do ./manage.py runserver; sleep 15; done
Saturday, June 3, 2017
Django with Python 3 and MySQL database
Django with Python 3 and MySQL database
I read many folks are having problems using MySQL db driver with Python 3, especially when setting up a Django app. The default Django 1.6.5 is only supporting the MySQLdb driver and that only works with Python 2.
I have been using mysql-connector-python package with Python 3 and it has built-in django support as well. I had ran into trouble like this http://bugs.mysql.com/bug.php?id=73232, but it is fixed now with the latest mysql-connector-python 1.2.3 release. The mysql-connector-python also works with Python 2.7 as well, and its a pure python library without native code, which makes the install much easier.
When installing mysql-connector-python, ensure you allow external hosted files like this
pip install --allow-all-external mysql-connector-python
If you are behind a firewall, use the proxy option
pip install --proxy my_proxy_server --allow-all-external mysql-connector-python
With these, now you can set your Django settings.py file with MySQL engine
DATABASES = {
default: {
ENGINE: mysql.connector.django,
NAME: mydb,
USER: myuser,
PASSWORD: mypassword,
}
}
PS: My initial testing with Django 1.7 also works pretty well with mysql-connector-python. How sweet!
UPDATE 07/15/2015:
The django 1.8 documentation now recommends using mysqlclient package if you want to use Python3 with MySQL backend. It should be a drop in replacement for MySQLdb.
Sunday, May 21, 2017
Distro NuTyX 8 2 93 Rereased Update to Python 3 Kernel 4 9 2
Distro NuTyX 8 2 93 Rereased Update to Python 3 Kernel 4 9 2

The developers of NuTyX, a distribution derived from Linux From Scratch with a custom package manager called "cards", have announced the availability of a new development snapshot. The new development release, NuTyX 8.2.93, is available in both 32-bit and 64-bit builds. A number of fixes have been applied to improve wireless networking and the default version of Python has been updated to Python 3
What is NuTyX ?
NuTyX began as a French Linux distribution which has added multi-language support. The distribution is created from Linux From Scratch and Beyond Linux From Scratch, with a custom package manager called "cards". The package manager can install individual binary packages, a group of related binary packages (e.g. desktop packages, such as KDE or Xfce), and compile source packages from "ports". The distribution is designed for intermediate and advanced Linux users.
About Release NuTyX 8.2.93
NuTyX 8.2.93 available with cards 2.1.105. The NuTyX team is please to announce the development release 8.2.93 of NuTyX. More then 1500 commits since version 8.2. New ISOs are available in 32- and 64-bits There sizes are respectively about 219MB and 224MB. The available graphical interfaces are: KDE Plasma, MATE, Xfce, LXDE, FLWM, TWM, JWM, Blackbox, Openbox, Ratpoison. Third development version for the next stable version of NuTyX 8.3 planned to be release for beginning of March. The wireless post-configuration have been improved. The ESSID bug is corrected. A composite name as ESSID is now possible
Others packages names changes
- xorg-mesa is now mesa
- fltk1 is now fltk
Main Updated Package List
- linux lts 4.4.38 -> 4.9.2
- cards 2.1.94 -> 2.1.105
- gcc 6.2.0 -> gcc 6.3.0
- curl 7.50.1 -> 7.51.1
- sqlite 3.11.1 -> 3.16.2
- dhcpcd 6.11.2 -> 6.11.5
- cups 2.1.4 -> 2.2.1
- python3 3.5.1 -> python 3.6.0
- python 2.7.13 -> python2 2.7.13
- glib 2.48.2 -> 2.50.2
- dbus 1.10.8 -> 1.10.14
- xorg-mesa 12.0.1 -> mesa 13.0.3
- xorg-server 1.18.4 -> xorg-server 1.19.0
- lxdm 0.5.3
- slim 1.3.6
- gtk 3.20.9 -> 3.22.6
- Qt5 5.7.0 -> Qt 5.8.0-rc
- KDE Applications 16.08.1 -> 16.12.0
- kf5 5.26 -> 5.29
- plasma 5.7.95 -> 5.8.5
- mate-desktop 1.14.1 -> 1.16.1
- lxde-session 0.5.2 -> 0.5.3
- avidemux 2.6.16
- hexchat 2.12.4
- firefox 49.0.2 -> 50.1.0
- chromium 53.0.2785.116 -> 55.0.2883.87
- libreoffice 5.2.1.1 -> 5.2.4.2
Further information on NuTyX 8.2.93 can be found on the distributions news page.
The 10 benefits of NuTyX
- You can install NuTyX from almost any other distribution, thanks to the BASH script named install-nutyx. This can be downloaded, study it carefully to see what it will do, then launch it from the host distribution. Briefly, the script will check for all the necessary tools, then start the download of a minimal set of packages and finally install them in the location you specified. Details and explanations can be found here.
- The hierarchical ports collection system provides maximum flexibility in managing software. Each collection is divided into a mandatory and an extra part.
- A very simple method called porting allows you to download a recipe from our repositories. This recipe is very similar to the scripts used in CRUX, and is usually less than 10 lines long. It can also determine and apply all needed Dependencies.
- It has the ability, once installed in a folder, to produce a personalized installable ISO version of NuTyX. The new live version can also be re-installed on other machines, should you so desire.
- It allows you to install a complete base binary package or a selection of individual base binaries packages. For example: devel, man, doc and lib.
- It has no need of a separate HDD or partition. The NuTyX installer creates a virtual environment and therefore is able to install/re-install without formatting the target disk or partition.
- It has unique installation coding, that prevents the NuTyX installer from FORMATTING the target partition. This means that NuTyX can be installed on a partition containing data: (for example) personal files and various non-system folders.
- It has a very powerful, yet simple command which allows you to revert to the base system and completely change the graphical user interface (for example from KDE to XFCE). This makes it unnecessary to reinstall or download every package again. The already downloaded packages will be simply be reinstalled automatically if still uptodate.
- It has a totally unique package manager made of expandable modules. It has no dependencies except glibc. One of its strong points is the ability to discover binary (run-time) dependencies automatically.
- It has the ability to compile all the packages properly per level in a dedicated chroot environment. After compilation, all the dependencies are again checked to make sure no broken links are found.
Download :
NuTyX_i686-8.2.93.iso
NuTyX_x86_64-8.2.93.iso
Subscribe to:
Posts (Atom)