Sergio Corbucci crafted one of the most popular and widely imitated of the Italian "spaghetti westerns" of the 1960s with this violent but stylish action saga. A mysterious man named Django (Franco Nero) arrives in a Mexican border town dragging a small coffin behind him. When he attempts to save a woman who is being attacked by a group of bandits, he finds himself in the middle of a conflict between Mexican gangsters and racist Yankee thugs, with the innocent townspeople and a fortune in Mexican gold stuck somewhere in between. Django becomes a force to be reckoned with when it's discovered his coffin actually contains a Gatling gun. Django proved so popular in Europe that over 30 sequels and follow-ups were produced, though Franco Nero would not return to the role until 1987's Django Strikes Again (the only sequel endorsed by Corbucci), which proved to be the last film in the series.
Like Sergio Leone‘s Fistful of Dollars, Django was also based on Akira Kurosawa’s 1961 classic samurai film Yojimbo. The main difference was that unlike the Mifune and Eastwood characters who were merely opportunistic drifters playing two groups against each other, Django was on a deliberately planned mission of revenge. Corbucci then brought new ideas to his story such as the use of a Ku Klux Klan style army which gave it more of a political/racial commentary. He also increased the amount of graphic violence and actually made Django an even more ruthless anti-hero than Clint Eastwood‘s Man With No Name. In addition, as Leone’s films had been stylized Roman inspired re-inventions of the American Westerns, Corbucci took Django down a much darker, bleak trail and created a gothic western world filled with sheer dread. For example, when you see the sequence where General Rodriguez cuts off a man’s ear and feeds it to him you’ll know its playing by its own rules.
During the production of Johnny Oro, Sergio Corbucci was approached by Manolo Bolognini, an ambitious young producer who had previously worked as Pier Paolo Pasolini's production manager on The Gospel According to St. Matthew, to write and direct a Spaghetti Western that would recoup the losses of his first film as producer, The Possessed. Corbucci immediately accepted Bolognini's offer, leaving Johnny Oro to be completed by his assistants. The director wanted to create a film inspired by Akira Kurosawa's Yojimbo, which he had seen in two years prior on recommendation from his regular cameraman, Enzo Barboni. Corbucci also wanted to make a film that would rival the success of A Fistful of Dollars, a Yojimbo adaptation directed by his friend Sergio Leone. According to Ruggero Deodato, Corbucci's assistant director, the director borrowed the idea of a protagonist who dragged a coffin behind him from a comic magazine he found on a news-stand in Via Veneto, Rome.
Bolognini gave Corbucci a very short schedule in which to write the film's screenplay. The first outlines of the story were written by Corbucci with his friend Piero Vivarelli; the pair wrote backwards from the final scene of the film. The decision to have the character's hands destroyed prior to the final showdown was influenced by Corbucci's previous film, Minnesota Clay, which depicted a blind protagonist who attempts to overcome his disability. It was also from this that the name "Django" was conceived for the hero - according to Alex Cox, Django's name is "a sick joke on the part of Corbucci and his screenwriter-brother Bruno" referencing jazz guitarist Django Reinhardt, who was known for his exceptional musicianship in spite of the fourth and fifth fingers on his left hand being paralysed. Additionally, because Corbucci was a left-wing "political director", Cox suggests that the plot device of Django's machine gun being contained in a coffin, along with the cemetery-buried gold hunted by the lead characters of The Good, the Bad and the Ugly, may have been inspired by rumours surrounding the anti-Communist Gladio terrorists, who hid many of their 138 weapons caches in cemeteries. Major Jackson's use of Mexican peons as target practice also has historical precedence - Indigenous Brazilians had been used as target practice by white slavers as late as the 1950s. Corbucci is also alleged to have studied newsreel footage of the Ku Klux Klan in the creating of scenes with Major Jackson's men, who wear red hoods and scarves in the film.
Corbucci and Vivarelli's outline was then revised by Franco Rossetti. By the time filming began, Corbucci was directing from a "scaletta… like a synopsis, but more detailed, yet still not a full screenplay". Further screenplay contributions and revisions were made throughout production, namely by José Gutiérrez Maesso, Fernando Di Leo (who was not credited for his work on the script) and especially Bruno Corbucci. Actor Mark Damon has also claimed to have collaborated with Corbucci on the story prior to the film's production. Italian prints credit the Corbucci brothers with "story, screenplay & dialogue", while Rossetti, Maesso and Vivarelli are credited as "screenplay collaborators". English prints do not list Maesso, and credit Geoffrey Copleston for the English-language script.
Corbucci originally wanted to cast Mark Damon (who had played the title character of Johnny Oro) as Django, but Damon experienced a conflict in his scheduling and had to withdraw. Bolognini considered either Franco Nero or Peter Martell for the role, and eventually decided to have Fulvio Frizza, the head of Euro International Film (the film's distributor), choose the actor based on photographs of the three men. Frizza chose Nero, who was reluctant to appear in the film because he wanted to perform roles in more 'serious' films. He was eventually persuaded by his agent, Paola Petri, and her husband, director Elio Petri, to accept the role on the grounds that he would have "nothing to lose". Nero was 23 when he was cast; to give the impression of an older, Clint Eastwood-type persona, he grew out a beard, wore fake wrinkles around his eyes, and had his voice dubbed in post-production by actor Nando Gazzolo. He also asked Corbucci to have his character dressed in a black Union Army uniform as a reference to his family name (Nero means 'black' in English). During filming, Corbucci invited Sergio Leone to meet Nero, who felt that the young actor would become successful.
Filming began in December 1965 at the Tor Caldara nature reserve, near Lavinio in Italy. Most interior and exterior shots were filmed on the Elios Film set outside of Rome, which included a dilapidated Western town designed by Carlo Simi, who was a veteran of both Corbucci and Leone's films. Corbucci was at first dissatisfied with the muddy street of the Elios set (he initially wanted the film to be set in snowy locations, foreshadowing his work on The Great Silence), but was eventually persuaded by Bolognini and his wife, Nori Corbucci, to use the muddy locations. Production halted several days after filming began to allow the Corbucci brothers to finalize and complete the script, while Bolognini secured extra financial backing from the Spanish production company Tescia. Filming restarted in January, with several exteriors being filmed in Colmenar Viejo and La Pedriza of Manzanares El Real, near Madrid. The final gunfight between Django and Jackson's men was filmed in Canalone di Tolfa, near the Roman Lazio area. Filming concluded by late February 1966. Unlike most Spaghetti Westerns, which were filmed in 2.39:1 Techniscope and printed in Technicolor, Django was filmed in the standard European widescreen (1.66:1) format and printed in Eastmancolor.
In an interview for Segno Cinema magazine, Barboni explained that, during the two weeks of shooting at the Elios Film set, filming was made problematic by the low amount of available sunlight. Grey and heavy clouds covered the sky nearly permanently, making it extremely difficult for the crew to choose the right light. Many scenes turned out to be underexposed, but the type of film negative that was used permitted this, and the crew was enthusiastic about the visual effects created. Deodato has also stated that, partially as a result of the limitations imposed by the cold weather and the low budget, as well as the craftsmanship of production members such as costumer Marcella De Marchis (the wife of Roberto Rossellini), the film has a neorealistic effect comparable to the works of Rossellini and Gualtiero Jacopetti. Nero has noted that Corbucci displayed a keen sense of black humour throughout production, which once resulted in the director and his crew abandoning Nero during the shooting of the film's opening titles as a joke.
The soundtrack for Django was composed and conducted by Luis Bacalov, known then for his score on The Gospel According to St. Matthew. It was his first Western film score, and was followed several months later by his soundtrack for Damiano Damiani's A Bullet for the General, which reused several themes from his Django score. In comparison to the contemporary classical style of Ennio Morricone's Spaghetti Western scores, Bacalov's soundtrack is more traditional, and relies especially on brass and orchestral styles of instrumentation, although several tracks use distinctive elements of Latin and Rock music. The main titles theme, which was conducted by Bruno Nicolai and features lyrics by Franco Migliacci and Robert Mellin, was sung in English for the film by Rocky Roberts. An Italian version of the song, released only on the soundtrack album and as a single, was performed by Roberto Fia. The soundtrack album, originally released in 1985, was re-released in 2013 with a new song listing and additional tracks.