In 1917 the Allies were losing an artillery duel against heavy German guns along the Flanders coast in Belgium, and the important French Channel port of Dunkirk was being shelled by 38 cm German guns sited in Belgium at a range of over 24 miles .