In the quest to increase the share of renewable and residual energy sources in our energy system, and to reduce its greenhouse gas emissions, district heating networks and seasonal thermal energy storage have the potential to play a key role. Different studies prove the techno-economic potential of these technologies but, due to the added complexity, it is challenging to design and control such systems. This paper describes an integrated optimal design and control algorithm, which is applied to the design of a district heating network with solar thermal collectors, seasonal thermal energy storage and excess heat injection. The focus is mostly on the choice of the size and location of these technologies and less on the network layout optimisation. The algorithm uses a two-layer program, namely with a design optimisation layer implemented as a genetic algorithm and an optimal control evaluation layer implemented using the Python optimal control problem toolbox called modesto. This optimisation strategy is applied to the fictional district energy system case of the city of Genk in Belgium. We show that this algorithm can find optimal designs with respect to multiple objective functions and that even in the cheaper, less renewable solutions, seasonal thermal energy storage systems are installed in large quantities.